Skip to content

Commit

Permalink
Update the workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII committed Aug 7, 2024
1 parent fd55160 commit a56e3ba
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 77 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
71 changes: 51 additions & 20 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
45 changes: 0 additions & 45 deletions .github/workflows/toml.yml

This file was deleted.

0 comments on commit a56e3ba

Please sign in to comment.