From 191ffbbdfea18241b136fbed5e25dc2224af61b9 Mon Sep 17 00:00:00 2001 From: John Kastner <130772734+john-h-kastner-aws@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:55:16 -0400 Subject: [PATCH] Avoid duplicating build_and_test workflow (#397) --- .github/workflows/build_and_test.yml | 27 +++++++++++++++++++++++++++ .github/workflows/ci.yml | 26 +------------------------- .github/workflows/nightly_build.yml | 25 +------------------------ 3 files changed, 29 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/build_and_test.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 000000000..7e378efc3 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,27 @@ +name: Build and Test +on: + workflow_call: + +jobs: + build_and_test: + name: Build and Test + runs-on: ubuntu-latest + strategy: + matrix: + toolchain: + - stable + steps: + - uses: actions/checkout@v3 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + - run: ./panic_safety.sh + - run: cargo fmt --all --check + - run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose --features "experimental" + - run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose + - run: cargo doc --all-features --no-deps + - run: cargo clippy --all-features + - run: cargo test --verbose --features "experimental" + - run: cargo test --verbose + - run: cargo test --verbose --no-default-features + - run: cargo test --verbose -- --ignored + - run: cargo bench --no-run + - run: cargo audit --deny warnings # For some reason this hangs if you don't cargo build first diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da67d8cf0..c8686b465 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,31 +7,7 @@ env: CARGO_TERM_COLOR: always jobs: build_and_test: - name: Rust project - latest - runs-on: ubuntu-latest - strategy: - matrix: - toolchain: - - stable - steps: - - uses: actions/checkout@v3 - - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - run: cargo fmt --all --check - - run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose --features "experimental" - - run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose - - run: cargo test --verbose --features "experimental" - - run: cargo test --verbose - - run: cargo doc --all-features - - run: cargo clippy --all-features - - run: ./panic_safety.sh - - run: cargo test --verbose -- --ignored - - run: cargo bench --no-run - - run: cd cedar-policy ; cargo test --no-default-features --verbose - - run: cd cedar-policy-cli ; cargo test --no-default-features --verbose - - run: cd cedar-policy-core ; cargo test --no-default-features --verbose - - run: cd cedar-policy-formatter ; cargo test --no-default-features --verbose - - run: cd cedar-policy-validator ; cargo test --no-default-features --verbose - - run: cargo audit --deny warnings # For some reason this hangs if you don't cargo build first + uses: ./.github/workflows/build_and_test.yml cargo_semver_checks: name: Cargo SemVer Checks diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index d67144a2a..37f865a9c 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -7,27 +7,4 @@ env: CARGO_TERM_COLOR: always jobs: build_and_test: - name: Rust project - latest - runs-on: ubuntu-latest - strategy: - matrix: - toolchain: - - stable - steps: - - uses: actions/checkout@v3 - - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - run: cargo fmt --all --check - - run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose --features "experimental" - - run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose - - run: cargo test --verbose --features "experimental" - - run: cargo test --verbose - - run: cargo doc --all-features - - run: cargo clippy - - run: ./panic_safety.sh - - run: cargo test --verbose -- --ignored - - run: cargo bench --no-run - - run: cd cedar-policy ; cargo test --no-default-features --verbose - - run: cd cedar-policy-cli ; cargo test --no-default-features --verbose - - run: cd cedar-policy-core ; cargo test --no-default-features --verbose - - run: cd cedar-policy-formatter ; cargo test --no-default-features --verbose - - run: cd cedar-policy-validator ; cargo test --no-default-features --verbose + uses: ./.github/workflows/build_and_test.yml