From 6a28ae21d87b1fd614aaa62638ad0d713e3ae6e6 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Mon, 11 Sep 2023 13:16:43 -0500 Subject: [PATCH] Add build target matrix to CI, update some old workflow stuff --- .github/workflows/ci.yaml | 62 +++++++++++++++++++++++++++++----- .github/workflows/publish.yaml | 2 +- .github/workflows/release.yaml | 13 +++---- 3 files changed, 62 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b871d695..fee2a06e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,29 +5,75 @@ on: pull_request: workflow_dispatch: +defaults: + run: + shell: bash + jobs: - ci: - name: CI - runs-on: ubuntu-latest + fmt: + name: Check formatting + runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - components: rustfmt, clippy + components: rustfmt - - name: Rustfmt + - name: Check Formatting run: cargo fmt -- --check + ci: + needs: ["fmt"] + strategy: + matrix: + include: + - name: Windows x86_64 + runner-os: windows-latest + cargo-target: x86_64-pc-windows-msvc + + - name: Linux x86_64 + runner-os: ubuntu-latest + cargo-target: x86_64-unknown-linux-gnu + + - name: Linux aarch64 + runner-os: ubuntu-latest + cargo-target: aarch64-unknown-linux-gnu + + - name: macOS x86_64 + runner-os: macos-latest + cargo-target: x86_64-apple-darwin + + - name: macOS aarch64 + runner-os: macos-latest + cargo-target: aarch64-apple-darwin + + name: CI - ${{ matrix.name }} + runs-on: ${{ matrix.runner-os }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + targets: ${{ matrix.cargo-target }} + - name: Build - run: cargo build --locked + run: | + cargo build \ + --locked --all-features \ + --target ${{ matrix.cargo-target }} - - name: Clippy + - name: Lint run: cargo clippy - name: Test diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dcb01ca7..13fc2be0 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a2646f0d..3acda52f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,6 +6,10 @@ on: permissions: contents: write +defaults: + run: + shell: bash + env: CARGO_TARGET_DIR: output @@ -17,7 +21,7 @@ jobs: version: ${{ steps.get_version.outputs.value }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get version from manifest uses: SebRollen/toml-action@9062fbef52816d61278d24ce53c8070440e1e8dd @@ -60,14 +64,14 @@ jobs: runs-on: ${{ matrix.runner-os }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.cargo-target }} - - name: Install tooling (aarch64-unknown-linux-gnu) + - name: Install build tooling (aarch64-unknown-linux-gnu) if: matrix.cargo-target == 'aarch64-unknown-linux-gnu' run: | sudo apt-get update -y @@ -75,14 +79,12 @@ jobs: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - name: Build binary - shell: bash run: | cargo build \ --locked --release --all-features \ --target ${{ matrix.cargo-target }} - name: Create binary archive - shell: bash run: | mkdir -p staging if [ "${{ matrix.runner-os }}" = "windows-latest" ]; then @@ -113,7 +115,6 @@ jobs: path: ./binaries - name: Discover binaries - shell: bash run: | cd ./binaries echo ""