|
14 | 14 | - "rust-toolchain.toml" |
15 | 15 |
|
16 | 16 | jobs: |
17 | | - check: |
18 | | - runs-on: ubuntu-22.04 |
19 | | - steps: |
20 | | - - name: Checkout |
21 | | - uses: actions/checkout@v4 |
22 | | - - uses: dtolnay/rust-toolchain@stable |
23 | | - - uses: Swatinem/rust-cache@v2 |
24 | | - - name: checks |
25 | | - run: | |
26 | | - cargo fmt --all --check |
| 17 | + quality-gate: |
| 18 | + uses: ./.github/workflows/quality-gate.yml |
| 19 | + with: |
| 20 | + checks-command: "--all --check" |
| 21 | + clippy-command: "-- -D warnings" |
| 22 | + tests-command: "test" |
27 | 23 |
|
28 | 24 | deploy: |
29 | | - needs: [check] |
30 | | - runs-on: ubuntu-22.04 |
| 25 | + needs: [quality-gate] |
| 26 | + runs-on: ubuntu-latest |
31 | 27 | steps: |
32 | 28 | - name: Checkout |
33 | 29 | uses: actions/checkout@v4 |
34 | | - - uses: dtolnay/rust-toolchain@stable |
35 | | - - uses: Swatinem/rust-cache@v2 |
36 | | - - name: Install worker-build |
| 30 | + |
| 31 | + - name: Install nix |
| 32 | + uses: nixbuild/nix-quick-install-action@v30 |
| 33 | + with: |
| 34 | + nix_conf: | |
| 35 | + keep-env-derivations = true |
| 36 | + keep-outputs = true |
| 37 | +
|
| 38 | + - name: Restore and save Nix store |
| 39 | + uses: nix-community/cache-nix-action@v6 |
| 40 | + with: |
| 41 | + primary-key: build-${{ runner.os }}-${{ hashFiles('**/*.nix', 'flake.lock') }} |
| 42 | + restore-prefixes-first-match: build-${{ runner.os }}- |
| 43 | + |
| 44 | + - name: Build nix |
| 45 | + run: nix build |
| 46 | + |
| 47 | + - name: Fix up wrangler toml |
| 48 | + working-directory: . |
37 | 49 | run: | |
38 | | - cargo install worker-build |
| 50 | + echo "---- Before" |
| 51 | + cat wrangler.toml |
| 52 | + |
| 53 | + cat wrangler.toml | sed 's/main = "build/main = "result/' | sed 's/command = "worker-build --release"/command = "echo dummy build"/' >| wrangler.prod.toml |
| 54 | + |
| 55 | + echo "---- After" |
| 56 | + cat wrangler.prod.toml |
| 57 | +
|
39 | 58 | - name: Deploy |
40 | 59 | uses: cloudflare/wrangler-action@v3 |
41 | 60 | env: |
42 | 61 | CANGREBOT_API_ENDPOINT: ${{ secrets.CANGREBOT_API_ENDPOINT }} |
43 | 62 | CANGREBOT_APIKEY: ${{ secrets.CANGREBOT_APIKEY }} |
44 | 63 | with: |
| 64 | + wranglerVersion: "4.19.1" |
45 | 65 | apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
46 | 66 | accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |
| 67 | + command: deploy -c wrangler.prod.toml |
47 | 68 | secrets: | |
48 | 69 | CANGREBOT_API_ENDPOINT |
49 | 70 | CANGREBOT_APIKEY |
0 commit comments