From bc2e633c590cc5ea6352313b174176008dd85e92 Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Mon, 1 Apr 2024 09:59:57 +0200 Subject: [PATCH] modularize workflow (#66) --- .github/workflows/basic.yml | 56 +++++++++++++ .github/workflows/benchmarks.yml | 25 ++++++ .github/workflows/ci.yml | 131 ------------------------------ .github/workflows/tests.yml | 24 ++++++ .github/workflows/try_runtime.yml | 25 ++++++ 5 files changed, 130 insertions(+), 131 deletions(-) create mode 100644 .github/workflows/basic.yml create mode 100644 .github/workflows/benchmarks.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .github/workflows/try_runtime.yml diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml new file mode 100644 index 00000000..8ea03c4c --- /dev/null +++ b/.github/workflows/basic.yml @@ -0,0 +1,56 @@ +name: Basic + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + pull_request: + branches: + - main + push: + branches: + - main + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + fmt: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/setup + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.GH_TOKEN }} + + - name: Use Git CLI for Cargo + run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV + + - name: Cargo fmt + run: cargo +nightly fmt --all -- --check + + lint-and-check: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/setup + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.GH_TOKEN }} + + - name: Use Git CLI for Cargo + run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV + + - name: Cargo clippy + run: cargo +nightly clippy -- -D warnings + + - name: Check Code + run: cargo check diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml new file mode 100644 index 00000000..c9f39086 --- /dev/null +++ b/.github/workflows/benchmarks.yml @@ -0,0 +1,25 @@ +name: Benchmarks + +on: + workflow_dispatch: + +jobs: + benchmark: + needs: check + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/setup + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.GH_TOKEN }} + + - name: Use Git CLI for Cargo + run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV + + - name: Benchmark Build + run: cargo check --features runtime-benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 40018b94..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: CI - -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the main branch - pull_request: - branches: - - main - push: - branches: - - main - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - fmt: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: ./.github/actions/setup - - - name: Setup SSH - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.GH_TOKEN }} - - - name: Use Git CLI for Cargo - run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV - - - name: Cargo fmt - run: cargo +nightly fmt --all -- --check - - clippy: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: ./.github/actions/setup - - - name: Setup SSH - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.GH_TOKEN }} - - - name: Use Git CLI for Cargo - run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV - - - name: Cargo clippy - run: cargo +nightly clippy -- -D warnings - - check: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: ./.github/actions/setup - - - name: Setup SSH - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.GH_TOKEN }} - - - name: Use Git CLI for Cargo - run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV - - - name: Check Code - run: cargo check - - test: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: ./.github/actions/setup - - - name: Setup SSH - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.GH_TOKEN }} - - - name: Use Git CLI for Cargo - run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV - - - name: Test Code - run: cargo test - - benchmark: - needs: check - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: ./.github/actions/setup - - - name: Setup SSH - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.GH_TOKEN }} - - - name: Use Git CLI for Cargo - run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV - - - name: Benchmark Build - run: cargo check --features runtime-benchmarks - - try-runtime: - needs: check - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: ./.github/actions/setup - - - name: Setup SSH - uses: webfactory/ssh-agent@v0.5.3 - with: - ssh-private-key: ${{ secrets.GH_TOKEN }} - - - name: Use Git CLI for Cargo - run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV - - - name: Try-Runtime Build - run: cargo check --features try-runtime diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..e11242d8 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,24 @@ +name: Tests + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/setup + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.GH_TOKEN }} + + - name: Use Git CLI for Cargo + run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV + + - name: Test Code + run: cargo test diff --git a/.github/workflows/try_runtime.yml b/.github/workflows/try_runtime.yml new file mode 100644 index 00000000..83b34cea --- /dev/null +++ b/.github/workflows/try_runtime.yml @@ -0,0 +1,25 @@ +name: Try-runtime + +on: + workflow_dispatch: + +jobs: + try-runtime: + needs: check + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/setup + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.GH_TOKEN }} + + - name: Use Git CLI for Cargo + run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV + + - name: Try-Runtime Build + run: cargo check --features try-runtime