diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9739fe4..08cf171 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,18 +12,15 @@ defaults: run: shell: bash -env: - CARGO_INCREMENTAL: "0" - concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} - cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.event_name != 'merge_group' }} jobs: draft-release: name: Create a release draft if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: release-id: ${{ steps.create-release.outputs.id }} upload-url: ${{ steps.create-release.outputs.upload_url }} @@ -42,7 +39,7 @@ jobs: plan: name: Plan the execution - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} permissions: @@ -55,10 +52,6 @@ jobs: id: set-matrix with: plan-name: build - - name: Dump matrix context - env: - MATRIX_CONTEXT: ${{ toJson(steps.set-matrix.outputs.matrix) }} - run: echo "$MATRIX_CONTEXT" build: needs: @@ -116,19 +109,25 @@ jobs: upload_url: ${{ needs.draft-release.outputs.upload-url }} asset_path: target/build-package/archives/*.tar.gz + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: build-${{runner.os}} + path: target/build-package/archives/*.tar.gz + publish-release: needs: - draft-release - build name: Publish release if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 50 permissions: contents: write steps: - name: Publish release - uses: actions/github-script@v6 + uses: actions/github-script@v7 env: RELEASE_ID: ${{ needs.draft-release.outputs.release-id }} with: diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 95fab18..ed3c439 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -2,25 +2,28 @@ name: code on: push: + branches: + - "**" + - "!gh-readonly-queue/**" + merge_group: schedule: - cron: "0 20 * * 0" concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} - cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.event_name != 'merge_group' }} defaults: run: shell: bash env: - CARGO_INCREMENTAL: "0" RUSTDOCFLAGS: "-D warnings" jobs: plan: name: Plan the execution - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} permissions: @@ -33,10 +36,6 @@ jobs: id: set-matrix with: plan-name: code - - name: Dump matrix context - env: - MATRIX_CONTEXT: ${{ toJson(steps.set-matrix.outputs.matrix) }} - run: echo "$MATRIX_CONTEXT" test: needs: @@ -74,9 +73,45 @@ jobs: command: ${{ matrix.plan.mode.cargoCommand }} args: ${{ matrix.plan.mode.cargoArgs }} - cargo-deny: - name: cargo deny - runs-on: ubuntu-20.04 + downloadable-utils: + strategy: + matrix: + util: + - name: cargo deny + download: > + curl -sSL "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.14.20/cargo-deny-0.14.20-x86_64-unknown-linux-musl.tar.gz" | + sudo tar -xzvf - -C /usr/local/bin --strip-components=1 + run: cargo-deny check --hide-inclusion-graph --show-stats + requiresRust: true + + - name: taplo + download: > + curl -sSL "https://github.com/tamasfe/taplo/releases/download/0.8.1/taplo-linux-x86_64.gz" | + zcat > /usr/local/bin/taplo \ + && chmod +x /usr/local/bin/taplo + run: taplo format --check + + - name: cargo-sort + download: > + curl -sSL "https://github.com/DevinR528/cargo-sort/releases/download/v1.0.9/cargo-sort-x86_64-unknown-linux-gnu.tar.gz" | + sudo tar -xzvf - -C /usr/local/bin + run: cargo-sort -cwg + + - name: cargo-machete + download: > + curl -sSL "https://github.com/bnjbvr/cargo-machete/releases/download/v0.6.0/cargo-machete-v0.6.0-x86_64-unknown-linux-musl.tar.gz" | + sudo tar -xzvf - --strip-components=1 -C /usr/local/bin + run: cargo-machete + + - name: typos + download: > + curl -sSL "https://github.com/crate-ci/typos/releases/download/v1.21.0/typos-v1.21.0-x86_64-unknown-linux-musl.tar.gz" | + sudo tar -xzvf - -C /usr/local/bin + run: typos + + fail-fast: false + name: ${{ matrix.util.name }} + runs-on: ubuntu-22.04 timeout-minutes: 20 permissions: contents: read @@ -85,18 +120,14 @@ jobs: uses: actions/checkout@v4 timeout-minutes: 5 - - name: Install rust toolchain - run: rustup show + - uses: ./.github/actions/common-setup + with: + requiresRust: ${{ matrix.util.requiresRust }} timeout-minutes: 10 - - name: Cache - uses: Swatinem/rust-cache@v2 + - name: Download ${{ matrix.util.name }} + run: ${{ matrix.util.download }} timeout-minutes: 10 - - name: Install cargo-deny - run: > - curl -sSL "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.13.7/cargo-deny-0.13.7-x86_64-unknown-linux-musl.tar.gz" | - sudo tar -xzvf - -C /usr/local/bin --strip-components=1 + - run: ${{ matrix.util.run }} timeout-minutes: 10 - - - run: cargo deny check diff --git a/.github/workflows/toml.yml b/.github/workflows/toml.yml deleted file mode 100644 index 08e3f18..0000000 --- a/.github/workflows/toml.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: toml - -on: - push: - schedule: - - cron: '0 20 * * 0' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref || github.run_id }} - cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} - -jobs: - - taplo: - name: taplo - runs-on: ubuntu-20.04 - permissions: - contents: read - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Check TOML files format - run: npx @taplo/cli@0.4.0 format --check - env: - npm_config_yes: "true" - - cargo-sort: - name: cargo-sort - runs-on: ubuntu-20.04 - permissions: - contents: read - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Install cargo-sort - run: > - curl -sSL "https://github.com/DevinR528/cargo-sort/releases/download/v1.0.5/cargo-sort-x86_64-unknown-linux-gnu.tar.gz" | - sudo tar -xzvf - -C /usr/local/bin - - - name: Lint TOML files - run: cargo-sort -cwg