From 677fb75ee565db80717d8b652b168a1827ed0bb4 Mon Sep 17 00:00:00 2001 From: Andrea Bedini Date: Tue, 16 Jan 2024 16:31:20 +0800 Subject: [PATCH] Refresh workflows (#96) - Bump actions - Factor out repetitions --- .github/actions/nix-setup/action.yml | 16 +++++++++++ .github/workflows/nix.yml | 38 ++++++------------------- .github/workflows/update-flake-lock.yml | 30 ++++++------------- 3 files changed, 33 insertions(+), 51 deletions(-) create mode 100644 .github/actions/nix-setup/action.yml diff --git a/.github/actions/nix-setup/action.yml b/.github/actions/nix-setup/action.yml new file mode 100644 index 0000000..8aab9db --- /dev/null +++ b/.github/actions/nix-setup/action.yml @@ -0,0 +1,16 @@ +name: Nix setup +description: Installs and configures nix and related tools +runs: + using: "composite" + steps: + - uses: DeterminateSystems/nix-installer-action@v9 + with: + github-token: ${{ env.GITHUB_TOKEN }} + extra-conf: accept-flake-config = true + + - uses: DeterminateSystems/magic-nix-cache-action@v2 + + - uses: cachix/cachix-action@v14 + with: + name: foliage + authToken: ${{ env.CACHIX_AUTH_TOKEN }} diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 360e76c..a37f880 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -13,20 +13,8 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v4 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - - uses: DeterminateSystems/magic-nix-cache-action@v2 - - - uses: cachix/cachix-action@v12 - with: - name: foliage - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - - run: nix develop --accept-flake-config --command fourmolu -m check . + - uses: ./.github/actions/nix-setup + - run: nix develop --command fourmolu -m check . build: runs-on: @@ -34,19 +22,9 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v4 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - - uses: DeterminateSystems/magic-nix-cache-action@v2 - - - uses: cachix/cachix-action@v12 - with: - name: foliage - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - - run: nix build --accept-flake-config - - - run: nix build --accept-flake-config .#checks.x86_64-linux.foliage:test:foliage-test-suite + - uses: ./.github/actions/nix-setup + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} + - run: nix build + - run: nix build --print-build-logs .#checks.x86_64-linux.foliage:test:foliage-test-suite diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml index 08f2905..ee0b48d 100644 --- a/.github/workflows/update-flake-lock.yml +++ b/.github/workflows/update-flake-lock.yml @@ -3,34 +3,22 @@ name: update-flake-lock on: workflow_dispatch: # allows manual triggering schedule: - - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 + - cron: "0 0 * * 0" # runs weekly on Sunday at 00:00 jobs: lockfile: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: ./.github/actions/nix-setup - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v4 + - uses: DeterminateSystems/update-flake-lock@v20 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - - uses: DeterminateSystems/magic-nix-cache-action@v2 - - - uses: cachix/cachix-action@v12 - with: - name: foliage - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - - name: Update flake.lock - uses: DeterminateSystems/update-flake-lock@v16 - with: - pr-title: "Update flake.lock" # Title of PR to be created - pr-labels: | # Labels to be set on the PR + # Title of PR to be created + pr-title: "Update flake.lock" + # Labels to be set on the PR + pr-labels: | dependencies automated - - name: Print PR number - run: echo Opened pull request ${{ steps.update.outputs.pull-request-number }}. + - run: echo Opened pull request ${{ steps.update.outputs.pull-request-number }}.