Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 62 additions & 61 deletions .github/workflows/nannou.yml
Original file line number Diff line number Diff line change
@@ -1,120 +1,121 @@
name: nannou
on: [push, pull_request]

# Deny warnings for all jobs.
env:
RUSTFLAGS: "-D warnings"
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0

# If a new commit is pushed to a PR, cancel any in-progress work on the same PR.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

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:
runs-on: ubuntu-latest
env:
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER: "lld"
timeout-minutes: 30
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 check --locked --examples --workspace --all-features
# - command: cargo test --locked --lib --bins --workspace --features "egui"
- command: cargo doc --locked --workspace --features "egui"
- command: cargo test --locked -p nannou_core --no-default-features --features "libm serde"
# - command: cargo build --locked -p nannou --target wasm32-unknown-unknown
- command: mdbook build guide/
- command: cargo test --locked -p book_tests
- name: fmt
command: cargo fmt --verbose --all -- --check
- name: check
command: cargo check --locked --workspace
- name: check-examples
command: cargo check --locked --examples --workspace
- name: check-all-features
command: cargo check --locked --examples --workspace --all-features
- name: test-core
command: cargo test --locked -p nannou_core --no-default-features --features "libm serde"
- name: test-book
command: cargo test --locked -p book_tests
- name: book
command: mdbook build guide/
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: nix develop --command ${{ matrix.command }}
- name: Install Linux dependencies
run: >
sudo apt-get update &&
sudo apt-get install --no-install-recommends -y
libasound2-dev
libudev-dev
libwayland-dev
libxkbcommon-dev
libvulkan-dev
libclang-dev
libavcodec-dev
libavformat-dev
libavutil-dev
libavfilter-dev
libavdevice-dev
libswscale-dev
libswresample-dev
pkg-config
- name: Install mdbook
if: matrix.name == 'book'
run: cargo install mdbook --locked
- name: ${{ matrix.name }}
run: ${{ matrix.command }}

# Synchronise the verification jobs under one that we can depend on for publish jobs.
verifications:
needs:
[
cargo,
nix-flake-check,
nix-fmt-check,
]
needs: [cargo]
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 ]
needs: [verifications]
env:
CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Cargo publish nannou_core
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_core/Cargo.toml
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_core/Cargo.toml
- name: Cargo publish nannou_wgpu
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_wgpu/Cargo.toml
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_wgpu/Cargo.toml
- name: Cargo publish nannou_mesh
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_mesh/Cargo.toml
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_mesh/Cargo.toml
- name: Cargo publish nannou
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou/Cargo.toml
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou/Cargo.toml
- name: Cargo publish nannou_audio
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_audio/Cargo.toml
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_audio/Cargo.toml
- name: Cargo publish nannou_laser
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_laser/Cargo.toml
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_laser/Cargo.toml
- name: Cargo publish nannou_osc
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_osc/Cargo.toml
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_osc/Cargo.toml
- name: Cargo publish nannou_egui
continue-on-error: true
run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_egui/Cargo.toml
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 ]
needs: [verifications]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: nix develop --command mdbook build guide/
- name: Install mdbook
run: cargo install mdbook --locked
- run: mdbook build guide/
- name: Commit book to deploy branch
run: |
git config user.email "action@github.com"
Expand Down
Loading