Make the reusable workflow a reusable action

This commit is contained in:
Bryan Richter 2026-04-13 10:20:48 +03:00
parent a4e934b5e2
commit 29cee69f8a
No known key found for this signature in database
GPG Key ID: B202264020068BFB
4 changed files with 32 additions and 27 deletions

22
.github/actions/stack-test/action.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: stack test
description: Build and test with stack
runs:
using: composite
steps:
- uses: haskell/ghcup-setup@v1
id: ghcup
with:
stack-hook: true
- uses: actions/cache@v4
with:
path: |
${{ steps.ghcup.outputs.basedir }}
~/.stack
key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml') }}
restore-keys: |
stack-${{ runner.os }}-
${{ runner.os }}-
- run: ghcup install stack
shell: bash
- run: stack test
shell: bash

View File

@ -10,7 +10,11 @@ concurrency:
cancel-in-progress: true
jobs:
stack-test:
uses: ./.github/workflows/stack-test.yml
name: stack test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/stack-test
flake-check:
name: flake check and push

View File

@ -6,4 +6,8 @@ on:
workflow_dispatch:
jobs:
stack-test:
uses: ./.github/workflows/stack-test.yml
name: stack test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/stack-test

View File

@ -1,25 +0,0 @@
# Reusable workflow used by the others. Not called directly usually.
name: stack test
on:
workflow_call:
jobs:
stack-test:
name: stack test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell/ghcup-setup@v1
id: ghcup
with:
stack-hook: true
- uses: actions/cache@v4
with:
path: |
${{ steps.ghcup.outputs.basedir }}
~/.stack
key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml') }}
restore-keys: |
stack-${{ runner.os }}-
${{ runner.os }}-
- run: ghcup install stack
- run: stack test