From a20e15c63ae414c03498cc8726dbe9e7d66fb0de Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 20 Jan 2025 03:07:03 -0500 Subject: [PATCH 1/4] use more specific primary-key and prefix-match --- .github/workflows/build-and-cache.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-cache.yml b/.github/workflows/build-and-cache.yml index 217fd43..9e75256 100644 --- a/.github/workflows/build-and-cache.yml +++ b/.github/workflows/build-and-cache.yml @@ -53,9 +53,9 @@ jobs: 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('flake.lock') }} + 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 }}- + restore-prefixes-first-match: nix-${{ runner.os }}-${{ matrix.machine }}- # do purge caches purge: true # purge all versions of the cache @@ -119,9 +119,9 @@ jobs: uses: nix-community/cache-nix-action@v5.1.0 with: # restore and save a cache using this key - primary-key: nix-${{ runner.os }}-${{ matrix.home }}-${{ hashFiles('flake.lock') }} + primary-key: nix-${{ runner.os }}-${{ matrix.home }}-${{ hashFiles('**/*.nix', 'flake.lock') }} # if there's no cache hit, restore a cache by this prefix - restore-prefixes-first-match: nix-${{ runner.os }}- + restore-prefixes-first-match: nix-${{ runner.os }}-${{ matrix.home }}- # do purge caches purge: true # purge all versions of the cache From d00651981daaf94891bd0c5434a32c5fde174b5a Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 20 Jan 2025 12:45:11 -0500 Subject: [PATCH 2/4] test alvr bump --- .github/workflows/build-and-cache.yml | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) 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: From 61db1c069b140ae34d11ef009cf1b7a5a89335bf Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 20 Jan 2025 12:54:40 -0500 Subject: [PATCH 3/4] use more compatible actions for build-packages --- .github/workflows/build-and-cache.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-cache.yml b/.github/workflows/build-and-cache.yml index 42aabc5..81a635d 100644 --- a/.github/workflows/build-and-cache.yml +++ b/.github/workflows/build-and-cache.yml @@ -16,19 +16,8 @@ jobs: 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: Install Nix + uses: cachix/install-nix-action@v30 - name: Sync repository uses: actions/checkout@v4 From 9b7629644c451e0b9615f284426b16f7724b62dd Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 20 Jan 2025 13:10:07 -0500 Subject: [PATCH 4/4] move packages to a separate workflow --- ...cache.yml => build-machines-and-homes.yml} | 57 +----------------- .github/workflows/build-packages.yml | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+), 56 deletions(-) rename .github/workflows/{build-and-cache.yml => build-machines-and-homes.yml} (69%) create mode 100644 .github/workflows/build-packages.yml diff --git a/.github/workflows/build-and-cache.yml b/.github/workflows/build-machines-and-homes.yml similarity index 69% rename from .github/workflows/build-and-cache.yml rename to .github/workflows/build-machines-and-homes.yml index 81a635d..76fcb36 100644 --- a/.github/workflows/build-and-cache.yml +++ b/.github/workflows/build-machines-and-homes.yml @@ -1,63 +1,8 @@ -name: build and cache random stuff +name: build and cache machines and homes 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: Install Nix - uses: cachix/install-nix-action@v30 - - - 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: diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml new file mode 100644 index 0000000..7531f6e --- /dev/null +++ b/.github/workflows/build-packages.yml @@ -0,0 +1,58 @@ +name: build and cache packages +on: + workflow_dispatch: +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: Install Nix + uses: cachix/install-nix-action@v30 + + - 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.package }}-${{ hashFiles('**/*.nix', 'flake.lock') }} + # if there's no cache hit, restore a cache by this prefix + restore-prefixes-first-match: nix-${{ runner.os }}-${{ matrix.package }}- + # 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 }}