Merge pull request #241 from forketyfork/fix/quit-teardown-lifetime #779
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| code: ${{ steps.filter.outputs.code }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| code: | |
| - '**' | |
| - '!**/*.md' | |
| - '!docs/**' | |
| build-matrix: | |
| needs: changes | |
| if: needs.changes.outputs.code == 'true' | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/architect/.zig-cache | |
| ZIG_LOCAL_CACHE_DIR: ${{ github.workspace }}/architect/.zig-cache/local | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| path: architect | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v31 | |
| with: | |
| extra_nix_config: | | |
| experimental-features = nix-command flakes | |
| - name: Cache Zig package cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: architect/.zig-cache | |
| key: zig-${{ runner.os }}-${{ hashFiles('architect/build.zig.zon') }} | |
| restore-keys: | | |
| zig-${{ runner.os }}- | |
| - name: Cache Nix store | |
| uses: cachix/cachix-action@v16 | |
| with: | |
| name: forketyfork | |
| authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
| - name: Prefetch Zig dependencies | |
| run: | | |
| for i in 1 2 3; do | |
| nix develop --accept-flake-config --command just setup && break | |
| if [ $i -eq 3 ]; then exit 1; fi | |
| sleep 5 | |
| done | |
| working-directory: architect | |
| - name: Build | |
| run: | | |
| for i in 1 2 3; do | |
| nix develop --accept-flake-config --command just build && break | |
| if [ $i -eq 3 ]; then exit 1; fi | |
| sleep 5 | |
| done | |
| working-directory: architect | |
| - name: Test | |
| run: | | |
| for i in 1 2 3; do | |
| nix develop --accept-flake-config --command just test && break | |
| if [ $i -eq 3 ]; then exit 1; fi | |
| sleep 5 | |
| done | |
| working-directory: architect | |
| - name: Lint | |
| run: | | |
| for i in 1 2 3; do | |
| nix develop --accept-flake-config --command just lint && break | |
| if [ $i -eq 3 ]; then exit 1; fi | |
| sleep 5 | |
| done | |
| working-directory: architect | |
| build: | |
| name: build | |
| needs: [changes, build-matrix] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check result | |
| run: | | |
| if [[ "${{ needs.changes.outputs.code }}" == "false" ]]; then | |
| echo "Documentation-only change, skipping build" | |
| exit 0 | |
| fi | |
| if [[ "${{ needs.build-matrix.result }}" == "success" ]]; then | |
| echo "Build succeeded" | |
| exit 0 | |
| fi | |
| echo "Build failed" | |
| exit 1 |