Attempt to simplify CI using Nix nannou-dev shell #204
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: nannou | |
on: [push, pull_request] | |
jobs: | |
nix-fmt-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- run: nix fmt -- --check ./ | |
cargo-audit: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: rustsec/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
cargo-fmt-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- run: nix develop --command cargo fmt --verbose --workspace -- --check | |
cargo-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: Swatinem/rust-cache@v2 | |
- run: nix develop --command cargo check --locked --workspace | |
- run: nix develop --command cargo check --examples --workspace | |
cargo-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: Swatinem/rust-cache@v2 | |
- run: nix develop --command cargo test --locked --workspace | |
cargo-test-all-features: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: Swatinem/rust-cache@v2 | |
- run: nix develop --command cargo test --locked --all-features --workspace | |
cargo-doc-all-features: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: Swatinem/rust-cache@v2 | |
- run: nix develop --command cargo doc --locked --all-features --workspace | |
cargo-test-nannou-core-no-std: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: Swatinem/rust-cache@v2 | |
- run: nix develop --command cargo test --locked -p nannou_core --no-default-features --features "libm serde" | |
cargo-build-nannou-wasm32: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: Swatinem/rust-cache@v2 | |
- run: nix develop --command cargo build --locked -p nannou --features "wasm-experimental" --target wasm32-unknown-unknown | |
verifications: | |
needs: | |
[ | |
cargo-build-nannou-wasm32, | |
cargo-check, | |
cargo-doc-all-features, | |
cargo-fmt-check, | |
cargo-test, | |
cargo-test-all-features, | |
cargo-test-nannou-core-no-std, | |
nix-fmt-check, | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Verifications complete" | |
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 | |
guide-build-book: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- run: nix develop --command mdbook build guide/ | |
guide-test-code: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: Swatinem/rust-cache@v2 | |
- run: nix develop --command cargo test --locked -p book_tests | |
guide-push-to-deploy: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
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 |