Skip to content

Add a nix flake check job. Add comments on CI jobs. #210

Add a nix flake check job. Add comments on CI jobs.

Add a nix flake check job. Add comments on CI jobs. #210

Workflow file for this run

name: nannou
on: [push, pull_request]
jobs:
# Check the nix code is formatted.
nix-fmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- run: nix fmt -- --check ./
# Check the nix flake is valid on macos and linux.
nix-flake-check:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- run: nix flake check
# A colleciton of cargo verifications that should pass before landing PRs.
cargo-verifications:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- command: cargo fmt --verbose --all -- --check
- command: cargo check --locked --workspace
- command: cargo check --locked --examples --workspace
- command: cargo test --locked --lib --bins --all-features --workspace
- command: cargo doc --locked --all-features --workspace
- command: cargo test --locked -p nannou_core --no-default-features --features "libm serde"
- command: cargo build --locked -p nannou --features "wasm-experimental" --target wasm32-unknown-unknown
- command: mdbook build guide/
- command: cargo test --locked -p book_tests
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: Swatinem/rust-cache@v2
- run: nix develop --command ${{ matrix.command }}
# Synchronise the verification jobs under one that we can depend on for publish jobs.
verifications:
needs:
[
cargo-verifications,
cargo-check-macos,

Check failure on line 51 in .github/workflows/nannou.yml

View workflow run for this annotation

GitHub Actions / nannou

Invalid workflow file

The workflow is not valid. .github/workflows/nannou.yml (Line: 51, Col: 9): Job 'verifications' depends on unknown job 'cargo-check-macos'. .github/workflows/nannou.yml (Line: 62, Col: 14): Job 'cargo-publish' depends on job 'verifications' which creates a cycle in the dependency graph.
nix-fmt-check,
]
runs-on: ubuntu-latest
steps:
- run: echo "Verifications complete"
# Publish all the crates.
# TODO: There's probs a single action out there for publishing a whole workspacce?
cargo-publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [ verifications ]
env:
CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: Swatinem/rust-cache@v2
- name: Cargo publish nannou_core
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_core/Cargo.toml
- name: Cargo publish nannou_wgpu
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_wgpu/Cargo.toml
- name: Cargo publish nannou_mesh
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_mesh/Cargo.toml
- name: Cargo publish nannou
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou/Cargo.toml
- name: Cargo publish nannou_audio
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_audio/Cargo.toml
- name: Cargo publish nannou_laser
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_laser/Cargo.toml
- name: Cargo publish nannou_osc
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_osc/Cargo.toml
- name: Cargo publish nannou_egui
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_egui/Cargo.toml
# Publish the guide by pushing it to `deploy` branch.
guide-push-to-deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [ verifications ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: Swatinem/rust-cache@v2
- run: nix develop --command mdbook build guide/
- name: Commit book to deploy branch
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
git remote add nannou-org https://${{ secrets.DEPLOY_GUIDE_TOKEN }}@github.com/${{ github.repository }}.git
git fetch nannou-org &&
git config credential.helper "store --file=.git/credentials" &&
echo "https://${{ secrets.DEPLOY_GUIDE_TOKEN }}:@github.com" > .git/credentials &&
git checkout deploy &&
cp -r guide/book/* . &&
git add -A . &&
git commit -m "Automated commit in preparation for deployment: $GITHUB_RUN_NUMBER" || true
- name: Push changes to deploy branch
run: |
git push --force --quiet nannou-org deploy &>/dev/null