Refresh workflows (#96)

- Bump actions
- Factor out repetitions
This commit is contained in:
Andrea Bedini 2024-01-16 16:31:20 +08:00 committed by GitHub
parent acecf00811
commit 677fb75ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 51 deletions

16
.github/actions/nix-setup/action.yml vendored Normal file
View File

@ -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 }}

View File

@ -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

View File

@ -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 }}.