nightly experiment: Fraction #166
Workflow file for this run
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: Build | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- staging | |
- trying | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
# Run cargo fmt --check, includes macros/ | |
style: | |
name: style | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
components: rustfmt | |
- name: cargo fmt --check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
# Compilation check | |
check: | |
name: check | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
toolchain: | |
- nightly | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache cargo dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
- ~/.cargo/bin/ | |
- ~/.cargo/registry/index/ | |
- ~/.cargo/registry/cache/ | |
- ~/.cargo/git/db/ | |
key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
${{ runner.OS }}-cargo- | |
- name: Cache build output dependencies | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | |
${{ runner.OS }}-build- | |
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
target: ${{ matrix.target }} | |
override: true | |
- name: cargo check | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: false | |
command: check | |
args: --target=${{ matrix.target }} | |
tests: | |
name: tests | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
toolchain: | |
- nightly | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache cargo dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
- ~/.cargo/bin/ | |
- ~/.cargo/registry/index/ | |
- ~/.cargo/registry/cache/ | |
- ~/.cargo/git/db/ | |
key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-cargo- | |
- name: Cache build output dependencies | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-build- | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
target: ${{ matrix.target }} | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
use-cross: false | |
command: test | |
args: --target=${{ matrix.target }} | |
# Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149 | |
# | |
# ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB! | |
ci-success: | |
name: ci | |
if: github.event_name == 'push' && success() | |
needs: | |
- style | |
- check | |
- tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Mark the job as a success | |
run: exit 0 |