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 Nov 25, 2024
1 parent af036cd commit a6a5010
Show file tree
Hide file tree
Showing 10 changed files with 540 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.

54 changes: 28 additions & 26 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,81 @@
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'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Checkout repository'
uses: actions/checkout@v4

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

- name: Build Cargo crates
- name: 'Build Cargo crates'
run: cargo build --release

- name: Test Cargo crates
- name: 'Test Cargo crates'
run: cargo test --all-features

- name: Build Cargo docs
- name: 'Build Cargo docs'
run: cargo doc --no-deps

- name: Lint Rust
- name: 'Lint Rust'
run: cargo clippy --all-targets --all-features

- name: Check Rust formatting
- name: 'Check Rust formatting'
run: cargo fmt --all -- --check

build_and_test_js:
name: Build and Test JavaScript
name: 'Build and test JavaScript'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Checkout repository'
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
- name: 'Run sccache-cache'
uses: mozilla-actions/[email protected]

# Triggers installation of the Rust toolchain
# Must be done before wasm-pack is installed
- name: Cargo metadata
- 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
- name: 'Generate canister declarations'
run: dfx generate

- name: Build NPM packages
- name: 'Build NPM packages'
run: pnpm build

- name: Build canisters
- name: 'Build canisters'
run: dfx build --check

- name: Test NPM packages
- name: 'Test NPM packages'
run: pnpm test

- name: Wasm test
- name: 'Wasm test'
run: wasm-pack test --node packages/ic-response-verification --features=js

- name: Check Typescript formatting
- name: 'Check Typescript formatting'
run: pnpm run format:check
31 changes: 15 additions & 16 deletions .github/workflows/check-commit-messages.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
name: Check commit messages
name: 'Check commit messages'

on:
pull_request:
branches:
- main

jobs:
check_commit_messages:
name: Check Commit Messages
name: 'Check commit messages'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Checkout repository'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: 'Setup Python'
uses: dfinity/ci-tools/actions/setup-python@main

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

- name: Install Commitzen
run: |
python -m pip install --upgrade pip
pip install -U Commitizen
- name: 'Check commit messages'
uses: dfinity/ci-tools/actions/check-commit-messages@main
with:
starting_commit: 'ac8f90b7c45e13e240d6c01a43d191b99f1aec4a'

- name: Check Commit Messages
run: cz check --rev-range ac8f90b7c45e13e240d6c01a43d191b99f1aec4a..HEAD
- name: 'Check pull request title'
uses: dfinity/ci-tools/actions/check-pr-title@main
28 changes: 15 additions & 13 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,47 +8,49 @@ env:

jobs:
bump_version:
name: Bump version
name: 'Bump version'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Checkout repository'
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: Install wasm-pack
- name: 'Setup wasm-pack'
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

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

- name: Bump Version
- name: 'Bump Version'
id: cz
uses: commitizen-tools/commitizen-action@master
with:
commit: false
push: false
github_token: ${{ secrets.GITHUB_TOKEN }}

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

- name: DFX prepare Certified Counter
- name: 'DFX prepare Certified Counter'
working-directory: examples/certification/certified-counter
run: |
dfx canister create --all
dfx generate backend
- name: Update Cargo.lock
- name: 'Update Cargo.lock'
run: |
cargo build
pnpm build
- name: Create Pull Request
- name: 'Create Pull Request'
uses: peter-evans/create-pull-request@v4
with:
title: 'Release ${{ steps.cz.outputs.version }}'
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
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'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Checkout repository'
uses: actions/checkout@v4

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

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

- name: Setup e2e Deps Cache
- name: 'Setup e2e Deps Cache'
uses: actions/cache@v3
with:
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
- name: 'e2e tests'
run: ./scripts/e2e.sh --use-latest-dfx
Loading

0 comments on commit a6a5010

Please sign in to comment.