Skip to content

Commit 01f3df1

Browse files
committed
ci: add cabal-install workflow
1 parent 5dc82ba commit 01f3df1

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed
+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: CI
2+
3+
# Trigger the workflow on push or pull request, but only for the master branch
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
push:
10+
branches: [master]
11+
12+
jobs:
13+
cabal:
14+
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest]
20+
ghc: ['9.8.4'] # bootstrapping compiler
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
submodules: "recursive"
26+
27+
- uses: haskell/ghcup-setup@v1
28+
29+
- id: ghcup
30+
run: |
31+
ghcup config set cache true
32+
echo "basedir=$(ghcup whereis basedir)" >> $GITHUB_OUTPUT
33+
34+
- id: ghcup-cache
35+
name: Cache GHCup basedir
36+
uses: actions/cache@v4
37+
with:
38+
key: ghcup-basedir-${{ github.run_id }}
39+
restore-keys: ghcup-basedir-
40+
path: ${{ steps.ghcup.outputs.basedir }}
41+
42+
- run: |
43+
ghcup install ghc --set ${{ matrix.ghc }}
44+
ghcup install cabal --set
45+
46+
- id: cabal-paths
47+
run: |
48+
cabal user-config init
49+
echo "store=$(cabal path --store-dir)" >> $GITHUB_OUTPUT
50+
echo "remote-repo-cache=$(cabal path --remote-repo-cache)" >> $GITHUB_OUTPUT
51+
52+
- name: Restore Hackage index
53+
uses: actions/cache/restore@v4
54+
with:
55+
key: hackage-${{ github.run_id }}
56+
restore-keys: hackage-
57+
path: ${{ steps.cabal-paths.outputs.remote-repo-cache }}
58+
59+
- run: cabal update
60+
61+
- name: Restore build artifacts
62+
uses: actions/cache/restore@v4
63+
with:
64+
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }}
65+
restore-keys: ${{ matrix.os }}-${{ matrix.ghc }}-
66+
path: |
67+
${{ steps.cabal-paths.outputs.store }}
68+
libraries/Cabal/dist-newstyle
69+
_build
70+
71+
- name: Build stage1
72+
run: make stage1
73+
74+
- name: Upload artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: stage1
78+
path: _stage1
79+
80+
- name: Save GHCup cache
81+
uses: actions/cache/save@v4
82+
if: always()
83+
with:
84+
key: ghcup-${{ github.run_id }}
85+
path: ${{ steps.ghcup.outputs.cachedir }}
86+
87+
- name: Save Hackage index
88+
uses: actions/cache/save@v4
89+
if: always()
90+
with:
91+
key: hackage-${{ github.run_id }}
92+
path: ${{ steps.cabal-paths.outputs.remote-repo-cache }}
93+
94+
- name: Save build artifacts
95+
if: always()
96+
uses: actions/cache/save@v4
97+
with:
98+
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }}
99+
path: |
100+
${{ steps.cabal-paths.outputs.store }}
101+
libraries/Cabal/dist-newstyle
102+
_build

0 commit comments

Comments
 (0)