diff --git a/.github/workflows/build-and-cache.yml b/.github/workflows/build-and-cache.yml index 9e75256..42aabc5 100644 --- a/.github/workflows/build-and-cache.yml +++ b/.github/workflows/build-and-cache.yml @@ -3,6 +3,72 @@ on: workflow_dispatch: push: jobs: + build-packages: + strategy: + matrix: + package: + - github:cything/nixpkgs/928e0c6874ab3e759305e93f806a4cf559645677#alvr + os: + - ubuntu-latest + - macos-latest + - ubuntu-24.04-arm + + runs-on: ${{ matrix.os }} + continue-on-error: true + steps: + - name: Maximize build disk space + uses: easimon/maximize-build-space@v10 + with: + overprovision-lvm: true + swap-size-mb: 1024 + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' + remove-docker-images: 'true' + build-mount-path: /nix + + - uses: nixbuild/nix-quick-install-action@master + + - name: Sync repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: cachix/cachix-action@v14 + with: + name: cything + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + useDaemon: false + installCommand: nix profile install nixpkgs#cachix + + - name: Setup Attic cache + uses: ryanccn/attic-action@v0 + with: + endpoint: ${{ vars.ATTIC_ENDPOINT }} + cache: ${{ vars.ATTIC_CACHE }} + token: ${{ secrets.ATTIC_TOKEN }} + + - name: Restore and cache Nix store + uses: nix-community/cache-nix-action@v5.1.0 + with: + # restore and save a cache using this key + primary-key: nix-${{ runner.os }}-${{ matrix.machine }}-${{ hashFiles('**/*.nix', 'flake.lock') }} + # if there's no cache hit, restore a cache by this prefix + restore-prefixes-first-match: nix-${{ runner.os }}-${{ matrix.machine }}- + # do purge caches + purge: true + # purge all versions of the cache + purge-prefixes: nix-${{ runner.os }}- + # created more than this number of seconds ago relative to the start of the `Post Restore` phase + purge-last-accessed: 86400 + # except the version with the `primary-key`, if it exists + purge-primary-key: never + # always save the cache + save-always: true + + - run: nix build -L ${{ matrix.package }} + build-machines: strategy: matrix: