Add build target matrix to CI, update some old workflow stuff

This commit is contained in:
Filip Tibell 2023-09-11 13:16:43 -05:00
parent e2aef015fa
commit 6a28ae21d8
No known key found for this signature in database
3 changed files with 64 additions and 17 deletions

View file

@ -5,29 +5,75 @@ on:
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
jobs: defaults:
ci: run:
name: CI shell: bash
runs-on: ubuntu-latest
jobs:
fmt:
name: Check formatting
runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
components: rustfmt, clippy components: rustfmt
- name: Rustfmt - name: Check Formatting
run: cargo fmt -- --check run: cargo fmt -- --check
- name: Build ci:
run: cargo build --locked needs: ["fmt"]
strategy:
matrix:
include:
- name: Windows x86_64
runner-os: windows-latest
cargo-target: x86_64-pc-windows-msvc
- name: Clippy - 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 --all-features \
--target ${{ matrix.cargo-target }}
- name: Lint
run: cargo clippy run: cargo clippy
- name: Test - name: Test

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable

View file

@ -6,6 +6,10 @@ on:
permissions: permissions:
contents: write contents: write
defaults:
run:
shell: bash
env: env:
CARGO_TARGET_DIR: output CARGO_TARGET_DIR: output
@ -17,7 +21,7 @@ jobs:
version: ${{ steps.get_version.outputs.value }} version: ${{ steps.get_version.outputs.value }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Get version from manifest - name: Get version from manifest
uses: SebRollen/toml-action@9062fbef52816d61278d24ce53c8070440e1e8dd uses: SebRollen/toml-action@9062fbef52816d61278d24ce53c8070440e1e8dd
@ -60,14 +64,14 @@ jobs:
runs-on: ${{ matrix.runner-os }} runs-on: ${{ matrix.runner-os }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
targets: ${{ matrix.cargo-target }} 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' if: matrix.cargo-target == 'aarch64-unknown-linux-gnu'
run: | run: |
sudo apt-get update -y sudo apt-get update -y
@ -75,14 +79,12 @@ jobs:
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Build binary - name: Build binary
shell: bash
run: | run: |
cargo build \ cargo build \
--locked --release --all-features \ --locked --release --all-features \
--target ${{ matrix.cargo-target }} --target ${{ matrix.cargo-target }}
- name: Create binary archive - name: Create binary archive
shell: bash
run: | run: |
mkdir -p staging mkdir -p staging
if [ "${{ matrix.runner-os }}" = "windows-latest" ]; then if [ "${{ matrix.runner-os }}" = "windows-latest" ]; then
@ -113,7 +115,6 @@ jobs:
path: ./binaries path: ./binaries
- name: Discover binaries - name: Discover binaries
shell: bash
run: | run: |
cd ./binaries cd ./binaries
echo "" echo ""