Skip to content

Commit

Permalink
Add build target matrix to CI, update some old workflow stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptibell committed Sep 11, 2023
1 parent e2aef01 commit 6a28ae2
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 15 deletions.
62 changes: 54 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
permissions:
contents: write

defaults:
run:
shell: bash

env:
CARGO_TARGET_DIR: output

Expand All @@ -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
Expand Down Expand Up @@ -60,29 +64,27 @@ 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
sudo apt-get install -y musl-tools clang llvm
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
Expand Down Expand Up @@ -113,7 +115,6 @@ jobs:
path: ./binaries

- name: Discover binaries
shell: bash
run: |
cd ./binaries
echo ""
Expand Down

0 comments on commit 6a28ae2

Please sign in to comment.