Files

99 lines
2.5 KiB
YAML

name: test
on:
workflow_dispatch:
push:
paths-ignore:
- .hooks/**
- CARGO_README.md
- README.md
- CHANGELOG.md
- INTEGRATION.md
- .gitignore
- .gitattributes
- LICENSE*
- run.sh
- run.ps1
pull_request:
paths-ignore:
- .hooks/**
- CARGO_README.md
- README.md
- CHANGELOG.md
- INTEGRATION.md
- .gitignore
- .gitattributes
- LICENSE*
- run.sh
- run.ps1
schedule:
- cron: "30 14 * * 1" # every Monday, 9:30 AM CDT
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
tools: musl-tools
artifact: true
- os: macos-13
target: x86_64-apple-darwin
# - os: macos-latest
# target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
name: test-${{ matrix.os }}-${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.79
targets: ${{ matrix.target }}
- name: Install Linker Tools
if: matrix.tools
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.tools }}
# ensure has a newline at the end
[ "$(tail -c 1 .cargo/config.toml)" != "" ] && echo >> .cargo/config.toml
cat .cargo/config.github.toml >> .cargo/config.toml
- name: Cache Rust dependencies
uses: actions/cache@v4.0.2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
target
key: testing-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
testing-${{ runner.os }}-${{ matrix.target }}-
testing-${{ runner.os }}-
- name: Run tests
run: cargo test --verbose --target ${{ matrix.target }}
- name: Build
if: matrix.artifact
run: cargo build --verbose --target ${{ matrix.target }}
- name: Upload Artifact
if: matrix.artifact
uses: actions/upload-artifact@v4
with:
name: spotify-quickauth-${{ github.sha }}-${{ matrix.target }}
path: target/${{ matrix.target }}/debug/spotify-quickauth