71 lines
1.8 KiB
YAML
71 lines
1.8 KiB
YAML
name: Rust CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Build
|
|
run: cargo build --verbose
|
|
- name: Run tests
|
|
run: cargo test --verbose
|
|
|
|
cross-compile:
|
|
runs-on: ${{ matrix.host }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- host: ubuntu-latest
|
|
target: x86_64-pc-windows-gnu
|
|
- host: macOS-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
- host: macOS-latest
|
|
target: x86_64-pc-windows-gnu
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: ${{ matrix.target }}
|
|
override: true
|
|
- name: Install dependencies
|
|
run: |
|
|
if [ "${{ matrix.host }}" = "ubuntu-latest" ]; then
|
|
sudo apt-get update
|
|
sudo apt-get install -y mingw-w64
|
|
elif [ "${{ matrix.host }}" = "macOS-latest" ]; then
|
|
brew install mingw-w64
|
|
fi
|
|
- name: Cross-compile
|
|
run: cargo build --verbose --target ${{ matrix.target }}
|