Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
478a085ffe |
1 changed files with 109 additions and 0 deletions
109
.github/workflows/ci.yml
vendored
Normal file
109
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
name: Simple build & test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master" ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
name: ${{ matrix.make.name }} (${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
rust: [stable, nightly]
|
||||||
|
task:
|
||||||
|
- name: Clippy
|
||||||
|
cmd: "cargo clippy -D warnings"
|
||||||
|
- name: Test
|
||||||
|
cmd: "cargo test"
|
||||||
|
- name: Format
|
||||||
|
cmd: "cargo fmt --all --check"
|
||||||
|
- name: Build
|
||||||
|
cmd: "cargo build --frozen --release"
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
sccache-path: /home/runner/.cache/sccache
|
||||||
|
- os: macos-latest
|
||||||
|
sccache-path: /Users/runner/Library/Caches/Mozilla.sccache
|
||||||
|
exclude:
|
||||||
|
- os: macos-latest
|
||||||
|
rust: stable
|
||||||
|
task:
|
||||||
|
name: Clippy
|
||||||
|
- os: macos-latest
|
||||||
|
rust: nightly
|
||||||
|
task:
|
||||||
|
name: Clippy
|
||||||
|
- os: macos-latest
|
||||||
|
rust: stable
|
||||||
|
task:
|
||||||
|
name: Format
|
||||||
|
- os: macos-latest
|
||||||
|
rust: nightly
|
||||||
|
task:
|
||||||
|
name: Format
|
||||||
|
env:
|
||||||
|
RUST_BACKTRACE: full
|
||||||
|
RUSTC_WRAPPER: sccache
|
||||||
|
RUSTV: ${{ matrix.rust }}
|
||||||
|
SCCACHE_CACHE_SIZE: 2G
|
||||||
|
SCCACHE_DIR: ${{ matrix.sccache-path }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Install sccache (ubuntu-latest)
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
env:
|
||||||
|
LINK: https://github.com/mozilla/sccache/releases/download
|
||||||
|
SCCACHE_VERSION: 0.2.13
|
||||||
|
run: |
|
||||||
|
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
|
||||||
|
mkdir -p $HOME/.local/bin
|
||||||
|
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
|
||||||
|
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
- name: Install sccache (macos-latest)
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
run: |
|
||||||
|
brew update
|
||||||
|
brew install sccache
|
||||||
|
- name: Install Rust ${{ matrix.rust }}
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.rust }}
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-
|
||||||
|
- name: Save sccache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ matrix.sccache-path }}
|
||||||
|
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-sccache-
|
||||||
|
- name: Start sccache server
|
||||||
|
run: sccache --start-server
|
||||||
|
- name: Install rustfmt
|
||||||
|
if: matrix.task.name == 'Format'
|
||||||
|
run: rustup component add rustfmt
|
||||||
|
- name: ${{ matrix.task.name }}
|
||||||
|
run: ${{ matrix.task.cmd }}
|
||||||
|
- name: Print sccache stats
|
||||||
|
run: sccache --show-stats
|
||||||
|
- name: Stop sccache server
|
||||||
|
run: sccache --stop-server
|
||||||
|
continue-on-error: true
|
Loading…
Add table
Reference in a new issue