Skip to content

Commit

Permalink
ci: switch to shared actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanosdev committed Dec 10, 2024
1 parent 911afa6 commit 0d56e53
Show file tree
Hide file tree
Showing 11 changed files with 496 additions and 631 deletions.
1 change: 0 additions & 1 deletion .cz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
commitizen:
name: cz_conventional_commits
tag_format: $version
update_changelog_on_bump: true
version: 2.6.0
version_files:
- Cargo.toml
Expand Down
13 changes: 0 additions & 13 deletions .github/actions/setup-dfx/action.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/actions/setup-pnpm/action.yml

This file was deleted.

22 changes: 12 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
name: Build and Test
name: build_and_test

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
SCCACHE_GHA_ENABLED: 'true'
RUSTC_WRAPPER: 'sccache'

jobs:
build_and_test_rust:
name: Build and Test Rust
name: build_and_test_rust:required
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run sccache-cache
uses: mozilla-actions/[email protected]
Expand All @@ -39,15 +37,19 @@ jobs:
run: cargo fmt --all -- --check

build_and_test_js:
name: Build and Test JavaScript
name: build_and_test_js:required
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: ./.github/actions/setup-pnpm
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@main

- uses: ./.github/actions/setup-dfx
- name: Setup DFX
uses: dfinity/setup-dfx@main
with:
dfx-version: 'auto'

- name: Run sccache-cache
uses: mozilla-actions/[email protected]
Expand All @@ -57,7 +59,7 @@ jobs:
- name: Cargo metadata
run: cargo metadata --format-version 1

- name: Install wasm-pack
- name: Setup wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Generate canister declarations
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/check-commit-messages.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/commitizen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: commitizen

on:
pull_request:

jobs:
check_commit_messages:
name: check_commit_messages:required
uses: dfinity/ci-tools/.github/workflows/check-commit-messages.yaml@main
with:
starting_commit: 'ac8f90b7c45e13e240d6c01a43d191b99f1aec4a'

check_pr_title:
name: check_pr_title:required
uses: dfinity/ci-tools/.github/workflows/check-pr-title.yaml@main
55 changes: 25 additions & 30 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create Release PR
name: create_release_pr

on: workflow_dispatch

Expand All @@ -8,34 +8,38 @@ env:

jobs:
bump_version:
name: Bump version
name: bump_version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup-pnpm
- name: 'Setup Python'
uses: dfinity/ci-tools/actions/setup-python@main

- uses: ./.github/actions/setup-dfx
- name: 'Setup Commitizen'
uses: dfinity/ci-tools/actions/setup-commitizen@main

- name: Install wasm-pack
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@main

- name: Setup DFX
uses: dfinity/setup-dfx@main

- name: Setup wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Bump Version
id: cz
uses: commitizen-tools/commitizen-action@master
with:
commit: false
push: false
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version
id: bump_version
uses: dfinity/ci-tools/actions/bump-version@main

- name: Print Version
run: echo "Bumping to version ${{ steps.cz.outputs.version }}"
run: echo "Bumping to version ${{ steps.bump_version.outputs.version }}"

- name: DFX prepare Certified Counter
working-directory: examples/certification/certified-counter
Expand All @@ -49,23 +53,14 @@ jobs:
pnpm build
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: dfinity/ci-tools/actions/create-pr@main
with:
title: 'Release ${{ steps.cz.outputs.version }}'
body: |
branch_name: 'release/${{ steps.bump_version.outputs.version }}'
pull_request_title: 'Release ${{ steps.bump_version.outputs.version }}'
pull_request_body: |
After merging this PR, tag the merge commit with:
```shell
git tag ${{ steps.cz.outputs.version }}
git push origin ${{ steps.cz.outputs.version }}
git tag ${{ steps.bump_version.outputs.version }}
git push origin ${{ steps.bump_version.outputs.version }}
```
commit-message: 'chore: release ${{ steps.cz.outputs.version }}'
branch: 'release/${{ steps.cz.outputs.version }}'
add-paths: |
.cz.yaml
CHANGELOG.md
Cargo.toml
Cargo.lock
packages/certificate-verification-js/package.json
packages/ic-certification-testing-wasm/package.json
packages/ic-response-verification-tests/package.json
packages/ic-response-verification-wasm/package.json
commit_message: 'chore: release ${{ steps.bump_version.outputs.version }}'
13 changes: 6 additions & 7 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
name: e2e Tests
name: e2e_tests

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
SCCACHE_GHA_ENABLED: 'true'
RUSTC_WRAPPER: 'sccache'

jobs:
e2e_tests:
name: e2e Tests
name: e2e_tests:required
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: ./.github/actions/setup-pnpm
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@main

- name: Run sccache-cache
uses: mozilla-actions/[email protected]
Expand All @@ -31,7 +30,7 @@ jobs:
path: tmp/
key: ${{ runner.os }}-tmp

- name: Install wasm-pack
- name: Setup wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: e2e tests
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: release

on:
push:
Expand All @@ -11,23 +11,28 @@ env:

jobs:
release:
name: Release
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup-pnpm
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@main

- uses: ./.github/actions/setup-dfx
- name: Setup DFX
uses: dfinity/setup-dfx@main

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Setup Python
uses: dfinity/ci-tools/actions/setup-python@main

- name: Setup Commitizen
run: pip install commitizen==2.42.1
uses: dfinity/ci-tools/actions/setup-commitizen@main

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
Expand Down
42 changes: 7 additions & 35 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,14 @@
name: Update changelog
name: generate_changelog

on:
push:
branches:
- main

jobs:
update_changelog:
name: Update Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Commitzen
run: |
python -m pip install --upgrade pip
pip install -U Commitizen
- name: Check Commit Messages
run: cz check --rev-range c8ecbc19b8c4a482e55907d37554d66f2f2f9a8f..HEAD

- name: Update Changelog
run: cz changelog

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
title: 'Update changelog'
commit-message: 'chore: update changelog'
branch: 'chore/update-changelog'
branch-suffix: 'short-commit-hash'
add-paths: |
CHANGELOG.md
generate_changelog:
uses: dfinity/ci-tools/.github/workflows/generate-changelog.yaml@main
with:
auto_merge: true
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 0d56e53

Please sign in to comment.