From 313971602c1091756f7c0606a48f796a935607cd Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 24 Jun 2022 01:22:06 +0200 Subject: [PATCH] iox-#5 Reuse build artifacts for clippy --- .github/workflows/format_lint_PR.yml | 31 ---------------------------- .github/workflows/rust.yml | 26 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/format_lint_PR.yml diff --git a/.github/workflows/format_lint_PR.yml b/.github/workflows/format_lint_PR.yml deleted file mode 100644 index ebce447..0000000 --- a/.github/workflows/format_lint_PR.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Rust Linting & Code Formatting - -on: - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - code-lint-format-check: - runs-on: ubuntu-latest - steps: - - name : Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: rustfmt, clippy - override: true - - name: Install dependencies - run: | - sudo apt update - sudo apt install -y libacl1-dev libncurses5-dev - - name: Check Formatting - run: | - cargo clippy - cargo fmt --check - diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d4cd8d0..0c6bec1 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,8 +10,23 @@ env: CARGO_TERM_COLOR: always jobs: + pre-flight-check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt + override: true + - name: Check formatting + run: cargo fmt --check + build-test: runs-on: ${{ matrix.os }} + needs: pre-flight-check strategy: matrix: os: [ubuntu-latest, macOS-latest] #Todo add windows-latest @@ -19,9 +34,12 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: hecrj/setup-rust-action@v1 + - name: Setup Rust + uses: actions-rs/toolchain@v1 with: - rust-version: ${{ matrix.toolchain }} + toolchain: ${{ matrix.toolchain }} + components: clippy + override: true - name: Setup cache uses: actions/cache@v2 with: @@ -39,11 +57,15 @@ jobs: sudo apt install -y libacl1-dev libncurses5-dev - name: Build run: cargo build --all --examples + - if: startsWith(matrix.os, 'ubuntu-latest') == true && startsWith(matrix.toolchain, 'stable') == true + name: Run clippy # clippy can reuse the previous build artifacts + run: cargo clippy - name: Run tests run: cargo test -- --test-threads=1 # prevent running multiple RouDiEnvironments in parallel coverage: runs-on: ubuntu-latest + needs: pre-flight-check steps: - uses: actions/checkout@v3 - name: Setup Rust