Merge remote-tracking branch 'origin/main' into papi #756
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Code checks' | |
on: | |
push: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -euxlo pipefail {0} | |
jobs: | |
format: | |
name: 'Format' | |
runs-on: ubuntu-22.04 | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Format code | |
uses: ./.github/actions/format | |
- name: Ignore some changes | |
run: while read -r line ; do git checkout "$line" ; done <.relaxedfmt | |
- name: Check formatted | |
run: | | |
test -z "$(git status --porcelain | grep -v --file .relaxedfmt)" || { | |
echo "FIX: Please run ./scripts/fmt" | |
git diff | |
exit 1 | |
} | |
sh-tests: | |
name: "Shell tests" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install tools | |
run: sudo apt-get install -yy shellcheck | |
- name: Lint shell | |
run: ./scripts/lint-sh | |
rust-tests: | |
name: "Rust tests" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Have relevant files changed? | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
test: | |
- '.github/workflows/check.yml' | |
- '**/*.rs' | |
- '**/Cargo.*' | |
- 'rust-toolchain.toml' | |
- uses: actions/cache@v4 | |
if: steps.changes.outputs.test == 'true' | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1 | |
- name: Lint rust code | |
if: steps.changes.outputs.test == 'true' | |
run: ./scripts/lint-rs | |
- name: Run Unit Tests | |
if: steps.changes.outputs.test == 'true' | |
shell: bash | |
run: scripts/test-rs | |
installation: | |
name: "dfx deploy & integration" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Have relevant files changed? | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
test: | |
- '!**/*.md' | |
- uses: actions/cache@v4 | |
if: steps.changes.outputs.test == 'true' | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1 | |
- name: Install dfx | |
uses: dfinity/setup-dfx@main | |
- name: Install build tools | |
run: scripts/setup cargo-binstall candid-extractor ic-wasm | |
- name: Start dfx | |
run: dfx start --clean --background | |
- name: Deploy all canisters | |
run: dfx deploy | |
- name: Verify that bindings are up to date | |
uses: ./.github/actions/bindings | |
- name: Run integration tests | |
run: ./scripts/test.signer.sh | |
- name: Stop dfx | |
run: dfx stop | |
check-pass: | |
name: "Checks pass" | |
needs: ["format", "rust-tests", "sh-tests", "installation"] | |
if: ${{ always() }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/needs_success | |
with: | |
needs: '${{ toJson(needs) }}' |