Skip to content
This repository was archived by the owner on Aug 24, 2023. It is now read-only.

Commit 5ef9b22

Browse files
authored
refactor(workflows): cleanup and generalize workflows, also add pnpm workflows (#71)
#### What this PR does / why we need it: As per the title. - Add a general `release.yml` pipeline for releasing NPM packages. - Add `environment: Release Docker` for `release-docker.yml` for deployment gates - Add new workflow for pnpm: - `Build (pnpm)` - `Lint (pnpm prettier)` - `Lint (pnpm eslint)` - `Test (pnpm)` is temporary failing since there isn't any test coverage to upload. - `Test (pnpm e2e)` deprecated and removeing soon. - Migrate old workflow for cargo to new name: - `Build (cargo)` - `Test (cargo)` - `Lint (cargo fmt)` - `Lint (cargo clippy)`
1 parent 123eaa5 commit 5ef9b22

21 files changed

+180
-89
lines changed

.github/ISSUE_TEMPLATE/1-bug-report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ about: Report a bug encountered with this project
44
labels: kind/bug
55
---
66

7-
<!--
7+
<!--
88
Please use this template while reporting a bug and provide as much info as possible.
99
1010
If the matter is security related, please disclose it privately via [email protected]

.github/ISSUE_TEMPLATE/3-general.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ labels: kind/question
77
<!--
88
If the matter is security related, please disclose it privately via [email protected]
99
-->
10-

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
#### What this PR does / why we need it:
44

55
#### Which issue(s) does this PR fixes?:
6+
67
<!--
78
(Optional) Automatically closes linked issue when PR is merged.
89
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
910
-->
11+
1012
Fixes #
1113

1214
#### Additional comments?:

.github/governance.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: v1
33
issue:
44
labels:
55
- prefix: triage
6-
list: [ "accepted" ]
6+
list: ['accepted']
77
multiple: false
88
author_association:
99
collaborator: true
@@ -78,7 +78,7 @@ issue:
7878

7979
- prefix: priority
8080
multiple: false
81-
list: [ "urgent-now", "important-soon" ]
81+
list: ['urgent-now', 'important-soon']
8282
author_association:
8383
collaborator: true
8484
member: true

.github/labeler.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,63 +34,63 @@ labels:
3434
- label: area/workflow
3535
sync: true
3636
matcher:
37-
files: ".github/**"
37+
files: '.github/**'
3838

3939
- label: area/packages
4040
sync: true
4141
matcher:
42-
files: "packages/**"
42+
files: 'packages/**'
4343

4444
- label: area/meta
4545
sync: true
4646
matcher:
47-
files: "meta/**"
47+
files: 'meta/**'
4848

4949
- label: area/docs
5050
sync: true
5151
matcher:
52-
files: "docs/**"
52+
files: 'docs/**'
5353

5454
- label: meta/consensus
5555
sync: true
5656
matcher:
57-
files: "meta/meta-consensus/**"
57+
files: 'meta/meta-consensus/**'
5858

5959
- label: meta/node
6060
sync: true
6161
matcher:
62-
files: "meta/meta-node/**"
62+
files: 'meta/meta-node/**'
6363

6464
- label: meta/runtime
6565
sync: true
6666
matcher:
67-
files: "meta/meta-runtime/**"
67+
files: 'meta/meta-runtime/**'
6868

6969
- label: packages/network
7070
sync: true
7171
matcher:
72-
files: "packages/network/**"
72+
files: 'packages/network/**'
7373

7474
- label: packages/testcontainers
7575
sync: true
7676
matcher:
77-
files: "packages/testcontainers/**"
77+
files: 'packages/testcontainers/**'
7878

7979
- label: packages/testsuite
8080
sync: true
8181
matcher:
82-
files: "packages/testsuite/**"
82+
files: 'packages/testsuite/**'
8383

8484
- label: packages/typescript
8585
sync: true
8686
matcher:
87-
files: "packages/typescript/**"
87+
files: 'packages/typescript/**'
8888

8989
checks:
90-
- context: "Semantic Pull Request"
90+
- context: 'Semantic Pull Request'
9191
description:
9292
success: Ready for review & merge.
93-
failure: "Missing semantic title or label for merge [kind(directory): title]"
93+
failure: 'Missing semantic title or label for merge [kind(directory): title]'
9494
labels:
9595
any:
9696
- kind/feature

.github/workflows/ci.yml

Lines changed: 113 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,37 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
1111
cancel-in-progress: true
1212

1313
jobs:
14-
Build:
14+
lint_cargo_fmt:
15+
name: Lint (cargo fmt)
1516
runs-on: ubuntu-latest
1617
steps:
1718
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
1819

19-
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3.0.8
20-
with:
21-
path: |
22-
~/.cargo/bin/
23-
~/.cargo/registry/index/
24-
~/.cargo/registry/cache/
25-
~/.cargo/git/db/
26-
target/
27-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
28-
2920
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # tag=v1.0.7
3021
with:
3122
profile: minimal
3223
toolchain: nightly
3324
target: wasm32-unknown-unknown
3425
default: true
3526
override: true
27+
components: rustfmt
3628

3729
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # tag=v1.0.3
3830
with:
39-
command: build
40-
args: --release --all
31+
command: fmt
32+
args: --all -- --check
4133

42-
lint_cargo_fmt:
43-
name: Lint (cargo fmt)
34+
lint_cargo_clippy:
35+
name: Lint (cargo clippy)
4436
runs-on: ubuntu-latest
4537
steps:
4638
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
@@ -52,34 +44,101 @@ jobs:
5244
target: wasm32-unknown-unknown
5345
default: true
5446
override: true
55-
components: rustfmt
47+
components: clippy
5648

57-
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # tag=v1.0.3
49+
- uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # tag=v1.0.7
5850
with:
59-
command: fmt
60-
args: --all -- --check
51+
token: ${{ secrets.GITHUB_TOKEN }}
52+
args: --all-features
6153

62-
lint_cargo_clippy:
63-
name: Lint (cargo clippy)
54+
lint_pnpm_prettier:
55+
name: Lint (pnpm prettier)
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
59+
60+
- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
61+
with:
62+
version: 7
63+
64+
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
65+
with:
66+
node-version: 16
67+
cache: pnpm
68+
69+
- run: pnpm install --frozen-lockfile
70+
71+
- run: pnpm prettier --check .
72+
73+
lint_pnpm_eslint:
74+
name: Lint (pnpm eslint)
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
78+
79+
- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
80+
with:
81+
version: 7
82+
83+
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
84+
with:
85+
node-version: 16
86+
cache: pnpm
87+
88+
- run: pnpm install --frozen-lockfile
89+
90+
- run: pnpm turbo run lint
91+
92+
build_cargo:
93+
name: Build (cargo)
6494
runs-on: ubuntu-latest
6595
steps:
6696
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
6797

98+
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3.0.8
99+
with:
100+
path: |
101+
~/.cargo/bin/
102+
~/.cargo/registry/index/
103+
~/.cargo/registry/cache/
104+
~/.cargo/git/db/
105+
target/
106+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
107+
68108
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # tag=v1.0.7
69109
with:
70110
profile: minimal
71111
toolchain: nightly
72112
target: wasm32-unknown-unknown
73113
default: true
74114
override: true
75-
components: clippy
76115

77-
- uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # tag=v1.0.7
116+
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # tag=v1.0.3
78117
with:
79-
token: ${{ secrets.GITHUB_TOKEN }}
80-
args: --all-features
118+
command: build
119+
args: --release --all
81120

82-
Test:
121+
build_pnpm:
122+
name: Build (pnpm)
123+
runs-on: ubuntu-latest
124+
steps:
125+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
126+
127+
- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
128+
with:
129+
version: 7
130+
131+
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
132+
with:
133+
node-version: 16
134+
cache: pnpm
135+
136+
- run: pnpm install --frozen-lockfile
137+
138+
- run: pnpm build
139+
140+
test_cargo:
141+
name: Test (cargo)
83142
runs-on: ubuntu-latest
84143
steps:
85144
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
@@ -109,14 +168,37 @@ jobs:
109168
files: ${{ steps.coverage.outputs.report }}
110169
fail_ci_if_error: true
111170

112-
e2e:
171+
test_pnpm:
172+
name: Test (pnpm)
173+
runs-on: ubuntu-latest
174+
steps:
175+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
176+
177+
- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
178+
with:
179+
version: 7
180+
181+
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
182+
with:
183+
node-version: 16
184+
cache: pnpm
185+
186+
- run: pnpm install --frozen-lockfile
187+
- run: pnpm test -- -- --maxWorkers=100% --coverage
188+
189+
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # tag=v3.1.0
190+
with:
191+
fail_ci_if_error: true
192+
193+
test_pnpm_e2e: # TODO(fuxingloh): move to PNPM
194+
name: Test (pnpm e2e)
113195
runs-on: ubuntu-latest
114196
steps:
115197
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
116198

117199
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
118200
with:
119-
node-version: '16'
201+
node-version: 16
120202
cache: 'npm'
121203
cache-dependency-path: 'ts-tests/package-lock.json'
122-
- run: cd ts-tests && npm ci && npm t
204+
- run: cd ts-tests && npm ci && npm t

.github/workflows/oss-governance-bot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: OSS Governance
22

33
on:
44
pull_request_target:
5-
types: [ synchronize, opened, labeled, unlabeled ]
5+
types: [synchronize, opened, labeled, unlabeled]
66
issues:
7-
types: [ opened, labeled, unlabeled ]
7+
types: [opened, labeled, unlabeled]
88
issue_comment:
9-
types: [ created ]
9+
types: [created]
1010

1111
permissions:
1212
contents: read

.github/workflows/oss-governance-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: OSS Governance
22

33
on:
44
pull_request_target:
5-
types: [ opened, edited, synchronize ]
5+
types: [opened, edited, synchronize]
66

77
permissions:
88
contents: read

.github/workflows/oss-governance-labels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: OSS Governance
22

33
on:
44
push:
5-
branches: [ main ]
6-
paths: [ .github/labels.yml ]
5+
branches: [main]
6+
paths: [.github/labels.yml]
77

88
permissions:
99
contents: read

0 commit comments

Comments
 (0)