From 4bd59d121fb247ffeb270bcae74ced65e93b46ad Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Sat, 28 Jan 2023 10:26:03 +0100 Subject: [PATCH] Parallelize automated updates --- .github/workflows/cachix.yml | 2 +- .github/workflows/update.yml | 49 ++++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cachix.yml b/.github/workflows/cachix.yml index 3109b26e..e67bc133 100644 --- a/.github/workflows/cachix.yml +++ b/.github/workflows/cachix.yml @@ -16,7 +16,7 @@ jobs: - urithiru steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@25d64bbf11b34ad6443b4169002d4a1b163a4b02 with: github_access_token: '${{ secrets.GITHUB_TOKEN }}' - name: Cachix diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 1d84a5c4..236ddd2a 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -6,11 +6,36 @@ on: workflow_dispatch: jobs: - update: + flake-update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@25d64bbf11b34ad6443b4169002d4a1b163a4b02 + with: + github_access_token: '${{ secrets.GITHUB_TOKEN }}' + - run: nix flake update + - name: Upload change flake.lock + uses: actions/upload-artifact@v3 + with: + name: flake.lock + path: flake.lock + build: + runs-on: ubuntu-latest + needs: flake-update + strategy: + matrix: + host: + - kharbranth + - kholinar + - lasting-integrity + - urithiru + steps: + - uses: actions/checkout@v3 + - name: Download changed flake.lock + uses: actions/download-artifact@v3 + with: + name: flake.lock + - uses: cachix/install-nix-action@25d64bbf11b34ad6443b4169002d4a1b163a4b02 with: github_access_token: '${{ secrets.GITHUB_TOKEN }}' - name: Cachix @@ -20,15 +45,17 @@ jobs: extraPullNames: "nix-community,accentor" authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' skipPush: true - - run: nix flake update - - run: nix build -L --no-link .#nixosConfigurations.lasting-integrity.config.system.build.toplevel - - run: nix eval --json ".#nixosConfigurations.lasting-integrity.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp - - run: nix build -L --no-link .#nixosConfigurations.urithiru.config.system.build.toplevel - - run: nix eval --json ".#nixosConfigurations.urithiru.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp - - run: nix build -L --no-link .#nixosConfigurations.kharbranth.config.system.build.toplevel - - run: nix eval --json ".#nixosConfigurations.kharbranth.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp - - run: nix build -L --no-link .#nixosConfigurations.kholinar.config.system.build.toplevel - - run: nix eval --json ".#nixosConfigurations.kholinar.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp + - run: nix build -L --no-link .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel + - run: nix eval --json ".#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel.outPath" | sed 's/"\(.*\)"/\1/' | cachix push chvp + commit: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + - name: Download changed flake.lock + uses: actions/download-artifact@v3 + with: + name: flake.lock - uses: stefanzweifel/git-auto-commit-action@v4.16.0 with: commit_message: "Update dependencies"