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

Commit

Permalink
refactor(workflows): cleanup and generalize workflows, also add pnpm …
Browse files Browse the repository at this point in the history
…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)`
  • Loading branch information
fuxingloh authored Sep 12, 2022
1 parent 123eaa5 commit 5ef9b22
Show file tree
Hide file tree
Showing 21 changed files with 180 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1-bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ about: Report a bug encountered with this project
labels: kind/bug
---

<!--
<!--
Please use this template while reporting a bug and provide as much info as possible.
If the matter is security related, please disclose it privately via security@defichain.com
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/3-general.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ labels: kind/question
<!--
If the matter is security related, please disclose it privately via security@defichain.com
-->

2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
#### What this PR does / why we need it:

#### Which issue(s) does this PR fixes?:

<!--
(Optional) Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes #

#### Additional comments?:
4 changes: 2 additions & 2 deletions .github/governance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: v1
issue:
labels:
- prefix: triage
list: [ "accepted" ]
list: ['accepted']
multiple: false
author_association:
collaborator: true
Expand Down Expand Up @@ -78,7 +78,7 @@ issue:

- prefix: priority
multiple: false
list: [ "urgent-now", "important-soon" ]
list: ['urgent-now', 'important-soon']
author_association:
collaborator: true
member: true
Expand Down
26 changes: 13 additions & 13 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,63 +34,63 @@ labels:
- label: area/workflow
sync: true
matcher:
files: ".github/**"
files: '.github/**'

- label: area/packages
sync: true
matcher:
files: "packages/**"
files: 'packages/**'

- label: area/meta
sync: true
matcher:
files: "meta/**"
files: 'meta/**'

- label: area/docs
sync: true
matcher:
files: "docs/**"
files: 'docs/**'

- label: meta/consensus
sync: true
matcher:
files: "meta/meta-consensus/**"
files: 'meta/meta-consensus/**'

- label: meta/node
sync: true
matcher:
files: "meta/meta-node/**"
files: 'meta/meta-node/**'

- label: meta/runtime
sync: true
matcher:
files: "meta/meta-runtime/**"
files: 'meta/meta-runtime/**'

- label: packages/network
sync: true
matcher:
files: "packages/network/**"
files: 'packages/network/**'

- label: packages/testcontainers
sync: true
matcher:
files: "packages/testcontainers/**"
files: 'packages/testcontainers/**'

- label: packages/testsuite
sync: true
matcher:
files: "packages/testsuite/**"
files: 'packages/testsuite/**'

- label: packages/typescript
sync: true
matcher:
files: "packages/typescript/**"
files: 'packages/typescript/**'

checks:
- context: "Semantic Pull Request"
- context: 'Semantic Pull Request'
description:
success: Ready for review & merge.
failure: "Missing semantic title or label for merge [kind(directory): title]"
failure: 'Missing semantic title or label for merge [kind(directory): title]'
labels:
any:
- kind/feature
Expand Down
144 changes: 113 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,37 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

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

jobs:
Build:
lint_cargo_fmt:
name: Lint (cargo fmt)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3.0.8
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # tag=v1.0.7
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown
default: true
override: true
components: rustfmt

- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # tag=v1.0.3
with:
command: build
args: --release --all
command: fmt
args: --all -- --check

lint_cargo_fmt:
name: Lint (cargo fmt)
lint_cargo_clippy:
name: Lint (cargo clippy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
Expand All @@ -52,34 +44,101 @@ jobs:
target: wasm32-unknown-unknown
default: true
override: true
components: rustfmt
components: clippy

- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # tag=v1.0.3
- uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # tag=v1.0.7
with:
command: fmt
args: --all -- --check
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

lint_cargo_clippy:
name: Lint (cargo clippy)
lint_pnpm_prettier:
name: Lint (pnpm prettier)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
with:
version: 7

- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
with:
node-version: 16
cache: pnpm

- run: pnpm install --frozen-lockfile

- run: pnpm prettier --check .

lint_pnpm_eslint:
name: Lint (pnpm eslint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
with:
version: 7

- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
with:
node-version: 16
cache: pnpm

- run: pnpm install --frozen-lockfile

- run: pnpm turbo run lint

build_cargo:
name: Build (cargo)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3.0.8
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # tag=v1.0.7
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown
default: true
override: true
components: clippy

- uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # tag=v1.0.7
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # tag=v1.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
command: build
args: --release --all

Test:
build_pnpm:
name: Build (pnpm)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
with:
version: 7

- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
with:
node-version: 16
cache: pnpm

- run: pnpm install --frozen-lockfile

- run: pnpm build

test_cargo:
name: Test (cargo)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
Expand Down Expand Up @@ -109,14 +168,37 @@ jobs:
files: ${{ steps.coverage.outputs.report }}
fail_ci_if_error: true

e2e:
test_pnpm:
name: Test (pnpm)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d # tag=v2.2.2
with:
version: 7

- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
with:
node-version: 16
cache: pnpm

- run: pnpm install --frozen-lockfile
- run: pnpm test -- -- --maxWorkers=100% --coverage

- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # tag=v3.1.0
with:
fail_ci_if_error: true

test_pnpm_e2e: # TODO(fuxingloh): move to PNPM
name: Test (pnpm e2e)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
with:
node-version: '16'
node-version: 16
cache: 'npm'
cache-dependency-path: 'ts-tests/package-lock.json'
- run: cd ts-tests && npm ci && npm t
- run: cd ts-tests && npm ci && npm t
6 changes: 3 additions & 3 deletions .github/workflows/oss-governance-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: OSS Governance

on:
pull_request_target:
types: [ synchronize, opened, labeled, unlabeled ]
types: [synchronize, opened, labeled, unlabeled]
issues:
types: [ opened, labeled, unlabeled ]
types: [opened, labeled, unlabeled]
issue_comment:
types: [ created ]
types: [created]

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oss-governance-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: OSS Governance

on:
pull_request_target:
types: [ opened, edited, synchronize ]
types: [opened, edited, synchronize]

permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/oss-governance-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: OSS Governance

on:
push:
branches: [ main ]
paths: [ .github/labels.yml ]
branches: [main]
paths: [.github/labels.yml]

permissions:
contents: read
Expand Down
Loading

0 comments on commit 5ef9b22

Please sign in to comment.