From 1394d5b5f4435d59697a822beb360dcf3ca3f017 Mon Sep 17 00:00:00 2001 From: Nuno Alexandre Date: Fri, 28 Oct 2022 01:25:26 +0200 Subject: [PATCH] ci: Split `tests` job into `tests` and `lints` (#1059) * ci: Split tests into tests and lint jobs * Rename lint.yml to lints.yml I see on Github that the job "lint" is still waiting while the Lints jobs have completed with success so I wonder if it's because the filename doesn't match the job name. * commit --- .github/workflows/lints.yml | 44 +++++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 3 ++- ci/script.sh | 5 ++++- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lints.yml diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml new file mode 100644 index 0000000000..5a4d438f68 --- /dev/null +++ b/.github/workflows/lints.yml @@ -0,0 +1,44 @@ +on: + push: + branches: [main, 'release-v**'] + pull_request: +name: Lints +jobs: + lints: + name: ${{ matrix.target }} + strategy: + matrix: + os: [ubuntu-latest] + target: [fmt, taplo, clippy] + runs-on: ${{ matrix.os }} + env: + RUST_TOOLCHAIN: "nightly-2022-05-09" + steps: + - name: Free space on Ubuntu + if: ${{ matrix.os }} == 'ubuntu-latest' + run: | + echo "Pre cleanup" + df -h + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + echo "Post cleanup" + df -h + - name: Check out code + uses: actions/checkout@v3 + - name: Install latest nightly + uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746 + with: + toolchain: ${{ env.RUST_TOOLCHAIN }} + default: true + - name: Install taplo + uses: actions-rs/install@v0.1 + with: + crate: taplo-cli + version: 0.7.2 + use-tool-cache: true + - uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c + - name: Run lints + run: ./ci/script.sh + env: + TARGET: ${{ matrix.target }} + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4b1729f2d0..91fa8ba7d8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - target: [tests, integration, lint, clippy] + target: [tests, integration] runs-on: ${{ matrix.os }} env: RUST_TOOLCHAIN: "nightly-2022-05-09" @@ -30,6 +30,7 @@ jobs: with: toolchain: ${{ env.RUST_TOOLCHAIN }} default: true + # We use Taplo to format our Cargo.toml files. - name: Install taplo uses: actions-rs/install@v0.1 with: diff --git a/ci/script.sh b/ci/script.sh index 0872d7f3d2..3aa32a92d9 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -39,8 +39,11 @@ case $TARGET in RUST_MIN_STACK=8388608 cargo test --release --package runtime-integration-tests ;; - lint) + fmt) cargo fmt -- --check + ;; + + taplo) taplo fmt --check ;;