Repository navigation
104 lines (92 loc) · 2.86 KB
/
Copy pathstack.yaml
File metadata and controls
104 lines (92 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Stack builds
defaults:
run:
shell: bash
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
on:
pull_request:
branches:
- '**'
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
ghcs: ${{ steps.ghcs.outputs.ghcs }}
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
# Need the repo checked out in order to read the file
- uses: actions/checkout@v7
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5.3.2
with:
cancel_others: false
paths_ignore: '[ "**/docs/**"
, "**.md"
, "**/LICENSE"
, "**.nix"
, "flake.lock"
, "**/README.md"
, "FUNDING.yml"
, ".gitlab-ci.yaml"
, ".gitlab/**"
]'
stack:
if: needs.pre_job.outputs.should_skip != 'true'
needs: pre_job
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- stack-yaml: stack.yaml
ghc: "9.8.4"
lts: "lts23"
- stack-yaml: stack-lts24.yaml
ghc: "9.10.3"
lts: "lts24"
name: stackage-${{ matrix.lts }}
steps:
- uses: actions/checkout@v7
- name: Setup GHC and Stack
uses: haskell-actions/setup@v2.12
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-no-global: true
- name: Restore ~/.stack cache
id: stack-cache-restore
uses: actions/cache/restore@v6
with:
path: ~/.stack
key: stack-${{ runner.os }}-${{ matrix.stack-yaml }}-${{ hashFiles(matrix.stack-yaml) }}
restore-keys: |
stack-${{ runner.os }}-${{ matrix.stack-yaml }}-
- name: Build
# builds tests but does not run them
run: |
stack \
--stack-yaml=${{ matrix.stack-yaml }} \
--system-ghc \
--no-terminal \
build --test --no-run-tests
- name: Save ~/.stack cache
# save cache when pushed to master
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@v6
with:
path: ~/.stack
key: stack-${{ runner.os }}-${{ matrix.stack-yaml }}-${{ hashFiles(matrix.stack-yaml) }}
stack_post_job:
if: always()
runs-on: ubuntu-latest
needs: [pre_job, stack]
steps:
- run: |
echo "jobs info: ${{ toJSON(needs) }}"
- if: contains(needs.*.result, 'failure')
run: exit 1
- if: contains(needs.*.result, 'cancelled') && needs.pre_job.outputs.should_skip != 'true'
run: exit 1