From 803ac58f4da9a67c9fe442a1afd288c8999e45f4 Mon Sep 17 00:00:00 2001 From: objz Date: Sun, 12 Jul 2026 18:52:57 +0200 Subject: [PATCH] ci: run network tests before releases --- .github/workflows/build.yml | 71 +---------------------------- .github/workflows/checks.yml | 84 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 7 +++ 3 files changed, 93 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/checks.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 956f815..b95d595 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,73 +12,6 @@ concurrency: group: ci-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} -env: - CARGO_TERM_COLOR: always - RUST_BACKTRACE: 1 - jobs: - format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt - - run: cargo fmt --all -- --check - - clippy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: dtolnay/rust-toolchain@stable - with: - components: clippy - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: "21" - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --all-targets --locked -- -D warnings - - build-and-test: - name: build and test (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - - steps: - - uses: actions/checkout@v6 - - - name: install Rust - uses: dtolnay/rust-toolchain@stable - - - name: install JDK - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: "21" - - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ matrix.os }} - - - name: cargo build - run: cargo build --locked - - - name: cargo test - run: cargo test --locked --all-targets - - network-canaries: - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: dtolnay/rust-toolchain@stable - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: "21" - - uses: Swatinem/rust-cache@v2 - - run: cargo test --locked --all-targets -- --ignored + checks: + uses: ./.github/workflows/checks.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..f864050 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,84 @@ +name: checks + +on: + workflow_call: + inputs: + network-tests: + type: boolean + default: false + ref: + type: string + default: "" + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ inputs.ref || github.sha }} + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - run: cargo fmt --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ inputs.ref || github.sha }} + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: "21" + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy --all-targets --locked -- -D warnings + + build-and-test: + name: build and test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ inputs.ref || github.sha }} + - uses: dtolnay/rust-toolchain@stable + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: "21" + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.os }} + - run: cargo build --locked + - run: cargo test --locked --all-targets + + network-tests: + if: inputs.network-tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ inputs.ref || github.sha }} + - uses: dtolnay/rust-toolchain@stable + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: "21" + - uses: Swatinem/rust-cache@v2 + - run: cargo test --locked --all-targets -- --ignored diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c97f25..c749663 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,14 @@ concurrency: cancel-in-progress: false jobs: + checks: + uses: ./.github/workflows/checks.yml + with: + network-tests: true + ref: master + prepare: + needs: checks runs-on: ubuntu-latest outputs: release: ${{ steps.version.outputs.release }}