Skip to content

Commit

Permalink
Refresh workflows (#96)
Browse files Browse the repository at this point in the history
- Bump actions
- Factor out repetitions
  • Loading branch information
andreabedini authored Jan 16, 2024
1 parent acecf00 commit 677fb75
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 51 deletions.
16 changes: 16 additions & 0 deletions .github/actions/nix-setup/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
38 changes: 8 additions & 30 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,18 @@ 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:
- ubuntu-latest

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
30 changes: 9 additions & 21 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}.

0 comments on commit 677fb75

Please sign in to comment.