CI workflow improvements #65
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: Basic | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
outputs: | |
cache-key: ${{ steps.cache-key.outputs.key }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate cache key | |
id: cache-key | |
run: echo "::set-output name=key::${{ runner.os }}-$(date +%Y-%m-%d)-$(git rev-parse --short HEAD)" | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ steps.cache-key.outputs.key }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.event.pull_request.head.repo.default_branch }}- | |
${{ runner.os }}- | |
- name: Setup common environment | |
run: | | |
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV | |
cargo install --git https://github.com/paritytech/psvm psvm | |
fmt: | |
needs: prepare | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cargo fmt | |
run: cargo +nightly fmt --all -- --check | |
lint-and-check: | |
needs: prepare | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cargo clippy | |
run: cargo +nightly clippy -- -D warnings | |
- name: Check Code | |
run: cargo check | |
check-dependencies: | |
needs: prepare | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check Dependency Versions | |
run: | | |
chmod +x ./scripts/check-dependency-versions.sh | |
./scripts/check-dependency-versions.sh | |
code_coverage: | |
needs: prepare | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run cargo-tarpaulin | |
uses: actions-rs/[email protected] | |
with: | |
version: "0.21.0" | |
- name: Upload to codecov.io | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Archive code coverage results | |
uses: actions/[email protected] | |
with: | |
name: code-coverage-report | |
path: cobertura.xml | |
block-production: | |
needs: prepare | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Zombienet setup | |
run: | | |
wget https://github.com/paritytech/zombienet/releases/download/v1.3.100/zombienet-linux-x64 | |
chmod +x zombienet-linux-x64 | |
yes 2>/dev/null | ./zombienet-linux-x64 setup polkadot | |
echo "PATH=$GITHUB_WORKSPACE:$PATH" >> $GITHUB_ENV | |
- name: Compile regionx-node | |
run: | | |
cargo build --release | |
cp ./target/release/regionx-node . | |
- name: Run smoke test 0001 | |
run: ./zombienet-linux-x64 -p native test ./zombienet_tests/0001-smoke-test.zndsl |