CI: add musl targets #117
This file contains 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: Test & Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
toolchain: [stable, nightly] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.toolchain == 'nightly' }} | |
name: Test - ${{ matrix.os }}/${{ matrix.toolchain }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
default: true | |
profile: minimal | |
components: clippy | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: target | |
key: cache-${{ matrix.os }}-${{ matrix.toolchain }}-${{ hashFiles('Cargo.lock') }} | |
restore-keys: cache-${{ matrix.os }}-${{ matrix.toolchain }}- | |
- name: Run clippy | |
uses: actions-rs/clippy-check@v1 | |
if: matrix.toolchain == 'stable' | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
- name: Check all possible feature combos | |
if: matrix.toolchain == 'stable' | |
run: ./test.sh 2>&1 | |
- name: Run clippy | |
if: matrix.toolchain != 'stable' | |
run: cargo clippy --all-features | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
target: | |
- x86_64-unknown-linux-gnu | |
- x86_64-unknown-linux-musl | |
- aarch64-unknown-linux-gnu | |
- aarch64-unknown-linux-musl | |
- armv7-unknown-linux-gnueabihf | |
- armv7-unknown-linux-musleabihf | |
profile: [base, roland] | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
profile: base | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
profile: roland | |
runs-on: ${{ matrix.os }} | |
continue-on-error: false | |
name: Build - ${{ matrix.profile }}/${{ matrix.target }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
profile: minimal | |
target: ${{ matrix.target }} | |
- name: Calculate features | |
id: features | |
shell: bash | |
run: python3 features.py ${{ matrix.os }} ${{ matrix.profile }} >> "$GITHUB_OUTPUT" | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: target | |
key: ${{ matrix.profile }}/${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} | |
restore-keys: ${{ matrix.profile }}/${{ matrix.target }}- | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ startsWith(matrix.target, 'aarch') || startsWith(matrix.target, 'arm') || endsWith(matrix.target, 'musl') }} | |
command: build | |
args: --release -p roblib-server --verbose --target ${{ matrix.target }} --features ${{ steps.features.outputs.f }} | |
- name: Rename file | |
shell: bash | |
run: | | |
[ ${{ matrix.os }} = "windows-latest" ] && EXT='.exe' || EXT='' | |
cp -v target/${{ matrix.target }}/release/roblib-server$EXT roblib-server-${{ matrix.profile }}$EXT | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: roblib-server-${{ matrix.profile }}-${{ matrix.target }} | |
path: | | |
roblib-server-${{ matrix.profile }}${{ startsWith(matrix.os, 'windows') && '.exe' || '' }} | |
if-no-files-found: error | |
link: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: beni69/artifact-link@v1 | |
with: | |
token: ${{ github.token }} | |
group: ^roblib-server-(?<col>\w+)-(?<row>[\w-]+)$ |