|
1 | 1 | name: nannou |
2 | 2 | on: [push, pull_request] |
3 | 3 |
|
4 | | -# Deny warnings for all jobs. |
5 | 4 | env: |
6 | | - RUSTFLAGS: "-D warnings" |
| 5 | + CARGO_TERM_COLOR: always |
| 6 | + CARGO_INCREMENTAL: 0 |
7 | 7 |
|
8 | 8 | # If a new commit is pushed to a PR, cancel any in-progress work on the same PR. |
9 | 9 | concurrency: |
10 | 10 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
11 | 11 | cancel-in-progress: true |
12 | 12 |
|
13 | 13 | jobs: |
14 | | - # Check the nix code is formatted. |
15 | | - nix-fmt-check: |
16 | | - runs-on: ubuntu-latest |
17 | | - steps: |
18 | | - - uses: actions/checkout@v3 |
19 | | - - uses: DeterminateSystems/nix-installer-action@main |
20 | | - - run: nix fmt -- --check ./ |
21 | | - |
22 | | - # Check the nix flake is valid on macos and linux. |
23 | | - nix-flake-check: |
24 | | - strategy: |
25 | | - fail-fast: false |
26 | | - matrix: |
27 | | - os: [ubuntu-latest, macos-latest] |
28 | | - runs-on: ${{ matrix.os }} |
29 | | - steps: |
30 | | - - uses: actions/checkout@v3 |
31 | | - - uses: DeterminateSystems/nix-installer-action@main |
32 | | - - run: nix flake check |
33 | | - |
34 | | - # A colleciton of cargo verifications that should pass before landing PRs. |
35 | 14 | cargo: |
36 | 15 | runs-on: ubuntu-latest |
37 | | - env: |
38 | | - CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER: "lld" |
| 16 | + timeout-minutes: 30 |
39 | 17 | strategy: |
40 | 18 | fail-fast: false |
41 | 19 | matrix: |
42 | 20 | include: |
43 | | - - command: cargo fmt --verbose --all -- --check |
44 | | - - command: cargo check --locked --workspace |
45 | | - - command: cargo check --locked --examples --workspace |
46 | | - - command: cargo check --locked --examples --workspace --all-features |
47 | | -# - command: cargo test --locked --lib --bins --workspace --features "egui" |
48 | | - - command: cargo doc --locked --workspace --features "egui" |
49 | | - - command: cargo test --locked -p nannou_core --no-default-features --features "libm serde" |
50 | | -# - command: cargo build --locked -p nannou --target wasm32-unknown-unknown |
51 | | - - command: mdbook build guide/ |
52 | | - - command: cargo test --locked -p book_tests |
| 21 | + - name: fmt |
| 22 | + command: cargo fmt --verbose --all -- --check |
| 23 | + - name: check |
| 24 | + command: cargo check --locked --workspace |
| 25 | + - name: check-examples |
| 26 | + command: cargo check --locked --examples --workspace |
| 27 | + - name: check-all-features |
| 28 | + command: cargo check --locked --examples --workspace --all-features |
| 29 | + - name: test-core |
| 30 | + command: cargo test --locked -p nannou_core --no-default-features --features "libm serde" |
| 31 | + - name: test-book |
| 32 | + command: cargo test --locked -p book_tests |
| 33 | + - name: book |
| 34 | + command: mdbook build guide/ |
53 | 35 | steps: |
54 | | - - uses: actions/checkout@v3 |
55 | | - - uses: DeterminateSystems/nix-installer-action@main |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + - uses: dtolnay/rust-toolchain@stable |
| 38 | + with: |
| 39 | + components: rustfmt |
56 | 40 | - uses: Swatinem/rust-cache@v2 |
57 | | - - run: nix develop --command ${{ matrix.command }} |
| 41 | + - name: Install Linux dependencies |
| 42 | + run: > |
| 43 | + sudo apt-get update && |
| 44 | + sudo apt-get install --no-install-recommends -y |
| 45 | + libasound2-dev |
| 46 | + libudev-dev |
| 47 | + libwayland-dev |
| 48 | + libxkbcommon-dev |
| 49 | + libvulkan-dev |
| 50 | + libclang-dev |
| 51 | + libavcodec-dev |
| 52 | + libavformat-dev |
| 53 | + libavutil-dev |
| 54 | + libavfilter-dev |
| 55 | + libavdevice-dev |
| 56 | + libswscale-dev |
| 57 | + libswresample-dev |
| 58 | + pkg-config |
| 59 | + - name: Install mdbook |
| 60 | + if: matrix.name == 'book' |
| 61 | + run: cargo install mdbook --locked |
| 62 | + - name: ${{ matrix.name }} |
| 63 | + run: ${{ matrix.command }} |
58 | 64 |
|
59 | | - # Synchronise the verification jobs under one that we can depend on for publish jobs. |
60 | 65 | verifications: |
61 | | - needs: |
62 | | - [ |
63 | | - cargo, |
64 | | - nix-flake-check, |
65 | | - nix-fmt-check, |
66 | | - ] |
| 66 | + needs: [cargo] |
67 | 67 | runs-on: ubuntu-latest |
68 | 68 | steps: |
69 | 69 | - run: echo "Verifications complete" |
70 | 70 |
|
71 | 71 | # Publish all the crates. |
72 | | - # TODO: There's probs a single action out there for publishing a whole workspacce? |
73 | 72 | cargo-publish: |
74 | 73 | if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
75 | | - needs: [ verifications ] |
| 74 | + needs: [verifications] |
76 | 75 | env: |
77 | 76 | CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }} |
78 | 77 | runs-on: ubuntu-latest |
79 | 78 | steps: |
80 | | - - uses: actions/checkout@v3 |
81 | | - - uses: DeterminateSystems/nix-installer-action@main |
| 79 | + - uses: actions/checkout@v4 |
| 80 | + - uses: dtolnay/rust-toolchain@stable |
82 | 81 | - uses: Swatinem/rust-cache@v2 |
83 | 82 | - name: Cargo publish nannou_core |
84 | 83 | continue-on-error: true |
85 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_core/Cargo.toml |
| 84 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_core/Cargo.toml |
86 | 85 | - name: Cargo publish nannou_wgpu |
87 | 86 | continue-on-error: true |
88 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_wgpu/Cargo.toml |
| 87 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_wgpu/Cargo.toml |
89 | 88 | - name: Cargo publish nannou_mesh |
90 | 89 | continue-on-error: true |
91 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_mesh/Cargo.toml |
| 90 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_mesh/Cargo.toml |
92 | 91 | - name: Cargo publish nannou |
93 | 92 | continue-on-error: true |
94 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou/Cargo.toml |
| 93 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou/Cargo.toml |
95 | 94 | - name: Cargo publish nannou_audio |
96 | 95 | continue-on-error: true |
97 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_audio/Cargo.toml |
| 96 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_audio/Cargo.toml |
98 | 97 | - name: Cargo publish nannou_laser |
99 | 98 | continue-on-error: true |
100 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_laser/Cargo.toml |
| 99 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_laser/Cargo.toml |
101 | 100 | - name: Cargo publish nannou_osc |
102 | 101 | continue-on-error: true |
103 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_osc/Cargo.toml |
| 102 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_osc/Cargo.toml |
104 | 103 | - name: Cargo publish nannou_egui |
105 | 104 | continue-on-error: true |
106 | | - run: nix develop --command cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_egui/Cargo.toml |
| 105 | + run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_egui/Cargo.toml |
107 | 106 |
|
108 | 107 | # Publish the guide by pushing it to `deploy` branch. |
109 | 108 | guide-push-to-deploy: |
110 | 109 | if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
111 | | - needs: [ verifications ] |
| 110 | + needs: [verifications] |
112 | 111 | runs-on: ubuntu-latest |
113 | 112 | steps: |
114 | | - - uses: actions/checkout@v3 |
115 | | - - uses: DeterminateSystems/nix-installer-action@main |
| 113 | + - uses: actions/checkout@v4 |
| 114 | + - uses: dtolnay/rust-toolchain@stable |
116 | 115 | - uses: Swatinem/rust-cache@v2 |
117 | | - - run: nix develop --command mdbook build guide/ |
| 116 | + - name: Install mdbook |
| 117 | + run: cargo install mdbook --locked |
| 118 | + - run: mdbook build guide/ |
118 | 119 | - name: Commit book to deploy branch |
119 | 120 | run: | |
120 | 121 | git config user.email "action@github.com" |
|
0 commit comments