fix(ci): use sudo for installs, build musl via Alpine container #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| defaults: | |
| run: | |
| shell: bash -euo pipefail {0} | |
| permissions: read-all | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install argsh | |
| run: | | |
| sudo curl -sL https://min.arg.sh -o /usr/local/bin/argsh | |
| sudo chmod +x /usr/local/bin/argsh | |
| - name: Install yq | |
| run: | | |
| sudo curl -sL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \ | |
| -o /usr/local/bin/yq | |
| sudo chmod +x /usr/local/bin/yq | |
| - name: Install bats | |
| run: | | |
| git clone --depth 1 https://github.com/bats-core/bats-core.git /tmp/bats | |
| sudo /tmp/bats/install.sh /usr/local | |
| - name: Run tests | |
| run: bats */*.bats | |
| rust: | |
| name: Rust (${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ${{ matrix.arch }} | |
| - name: Check | |
| run: cargo check --release | |
| - name: Build | |
| run: cargo build --release | |
| - name: Upload .so | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libjaml-linux-${{ matrix.arch }}.so | |
| if-no-files-found: error | |
| retention-days: 7 | |
| path: target/release/libjaml.so | |
| rust-musl: | |
| name: Rust (musl-${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| container: alpine:latest | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-latest | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install build tools | |
| run: apk add --no-cache rust cargo musl-dev | |
| - name: Build (musl) | |
| run: cargo build --release | |
| - name: Upload .so | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libjaml-linux-musl-${{ matrix.arch }}.so | |
| if-no-files-found: error | |
| retention-days: 7 | |
| path: target/release/libjaml.so |