-
-
Notifications
You must be signed in to change notification settings - Fork 259
160 lines (148 loc) · 5.15 KB
/
check-code-validation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: "[Check] Validation"
on: [pull_request]
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_GHACTIONS_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
setup-and-cache:
name: Setup and Cache Dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node and yarn
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Yarn Cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: |
yarn-cache-folder-
# We can skip the build for all dependencies, even for those whitelisted, because this process is used only to validate the yarn.lock file and populate the cache.
- name: Install deps
run: |
yarn --immutable --mode=skip-build
type-check:
name: Type Checking
needs: setup-and-cache
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: "Checkout branches for Nx"
uses: ./.github/actions/nx-checkout
- name: "Minimal yarn install"
uses: ./.github/actions/minimal-yarn-install
- name: Type Check
run: yarn nx:type-check --output-style=stream
lint:
name: Linting and formatting
needs: setup-and-cache
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: "Checkout branches for Nx"
uses: ./.github/actions/nx-checkout
- name: "Minimal yarn install"
uses: ./.github/actions/minimal-yarn-install
- name: ESlint Cache
uses: actions/cache@v4
with:
path: |
**/.eslintcache
!**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/.eslintrc.js') }}
- name: Lint JS
run: yarn lint:js --cache-strategy content
- name: Lint Styles
run: yarn nx:lint:styles --output-style=stream
unit-tests:
name: Unit Tests
needs: setup-and-cache
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: "Checkout branches for Nx"
uses: ./.github/actions/nx-checkout
- name: "Minimal yarn install"
uses: ./.github/actions/minimal-yarn-install
- name: Unit Tests
run: yarn nx:test-unit --output-style=stream
build-libs-for-publishing:
name: "Build libs for publishing"
needs: setup-and-cache
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: "Checkout branches for Nx"
uses: ./.github/actions/nx-checkout
- name: "Minimal yarn install"
uses: ./.github/actions/minimal-yarn-install
- name: Build Libs
run: yarn nx:build:libs --output-style=stream
other-checks:
name: Other Checks
needs: setup-and-cache
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: "Checkout branches for Nx"
uses: ./.github/actions/nx-checkout
- name: "Minimal yarn install"
uses: ./.github/actions/minimal-yarn-install
- name: Check Files for Correct Formatting
run: yarn nx format:check
- name: Verify TS Project References
run: yarn verify-project-references
- name: Detect unused dependencies
run: yarn depcheck
- name: Yarn Dedupe check
run: yarn dedupe --check
- name: Check dependency domain lists
run: ./scripts/ci/list-missing-dependencies.sh
- name: Verify Workspace Resolutions
run: yarn check-workspace-resolutions
- name: Msg-system Config Validation
run: yarn workspace @suite-common/message-system validate-config
- name: Translation Duplicates
run: yarn workspace @trezor/suite translations:list-duplicates
releases-revision-checks:
name: Releases revision Checks
needs: setup-and-cache
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: "Checkout branches for Nx"
uses: ./.github/actions/nx-checkout
- name: "Minimal yarn install"
uses: ./.github/actions/minimal-yarn-install
- name: Check releases.json files changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
releases-json:
- 'packages/connect-common/files/firmware/t1b1/releases.json'
- 'packages/connect-common/files/firmware/t2t1/releases.json'
if: steps.changes.outputs.releases-json == 'true'
- name: Check releases.json revisions
run: yarn workspace @trezor/connect-common validate-releases.json