ci #242
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
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# run every morning at 10am Pacific Time | |
- cron: '0 17 * * *' | |
name: ci | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
RUST_BACKTRACE: 1 | |
# Pin the nightly toolchain to prevent breakage. | |
# This should be occasionally updated. | |
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-10-07 | |
jobs: | |
env: | |
runs-on: ubuntu-latest | |
outputs: | |
rust-versions: ${{ steps.definitions.outputs.versions }} | |
msrv: ${{ steps.definitions.outputs.msrv }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Evaluate definitions | |
id: definitions | |
run: | | |
export MSRV=$(rustup show | awk 'NF' | awk 'END{print $2}') | |
echo "msrv=$MSRV" >> "$GITHUB_OUTPUT" | |
export RAW_VERSIONS="stable beta $RUST_NIGHTLY_TOOLCHAIN $MSRV" | |
export VERSIONS=$(echo $RAW_VERSIONS | jq -scR 'rtrimstr("\n")|split(" ")|.') | |
echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT" | |
checks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install rustfmt toolchain | |
run: | | |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal --component rustfmt | |
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | |
- name: Install clippy toolchain | |
run: | | |
rustup toolchain install stable --profile minimal --component clippy | |
rustup override set stable | |
- name: Run checks | |
run: | | |
cargo xtask checks --rustfmt-toolchain ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | |
udeps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install toolchain | |
id: toolchain | |
run: | | |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal | |
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | |
- uses: camshaft/rust-cache@v1 | |
- uses: camshaft/install@v1 | |
with: | |
crate: cargo-udeps | |
- name: Cache node_modules | |
uses: actions/[email protected] | |
continue-on-error: true | |
with: | |
path: duvet/www/node_modules | |
key: node-modules-${{ runner.os }}-${{ hashFiles('duvet/www/package-lock.json') }} | |
- name: Build script.js | |
run: | | |
cargo xtask build | |
- name: Run cargo udeps | |
run: cargo udeps --workspace --all-targets | |
env: | |
RUSTC_WRAPPER: "" | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: env | |
strategy: | |
matrix: | |
rust: ${{ fromJson(needs.env.outputs.rust-versions) }} | |
os: [ubuntu-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Install toolchain | |
id: toolchain | |
run: | | |
rustup toolchain install ${{ matrix.rust }} | |
rustup override set ${{ matrix.rust }} | |
- uses: camshaft/rust-cache@v1 | |
with: | |
key: ${{ matrix.target }} | |
- name: Cache node_modules | |
uses: actions/[email protected] | |
continue-on-error: true | |
with: | |
path: duvet/www/node_modules | |
key: node-modules-${{ runner.os }}-${{ hashFiles('duvet/www/package-lock.json') }} | |
- name: Run tests | |
run: | | |
cargo xtask test | |
action: # make sure the action works on a clean machine without building | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
- name: duvet help | |
run: duvet --help |