Skip to content

Commit 33d6b12

Browse files
committed
Refactor
1 parent cd6fc88 commit 33d6b12

File tree

1 file changed

+50
-38
lines changed

1 file changed

+50
-38
lines changed

.github/workflows/comprehensive-ci.yml

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ jobs:
2424
test-all-llvm-and-ghc-versions:
2525
name: Test All LLVM and GHC Versions (${{ matrix.runner }}, GHC ${{ matrix.ghc }}, LLVM ${{ matrix.llvm }})
2626
runs-on: ${{ matrix.runner }}
27-
timeout-minutes: 45
2827
strategy:
29-
fail-fast: false
3028
matrix:
31-
runner: [ubuntu-latest]
29+
runner: [ubuntu-latest, macos-latest, windows-latest]
3230
ghc: ['9.2.8', '9.4.8', '9.6.7', '9.8.4', '9.10.3', '9.12.2']
3331
llvm: ['14', '16', '18', '20', '21']
3432
steps:
@@ -48,10 +46,9 @@ jobs:
4846
llvm: ${{ matrix.llvm }}
4947

5048
cabal-check:
51-
name: Cabal check (${{ matrix.package }}) & sdist build
49+
name: Cabal check (${{ matrix.package }})
5250
runs-on: ubuntu-latest
5351
strategy:
54-
fail-fast: false
5552
matrix:
5653
package:
5754
- ansi-diff
@@ -61,8 +58,7 @@ jobs:
6158
- hs-bindgen-runtime
6259
- hs-bindgen-test-runtime
6360
cabal-version: ['3.16']
64-
ghc-version: ['9.2.8', '9.4.8', '9.6.7', '9.8.4', '9.10.3', '9.12.2']
65-
llvm-version: ['14', '16', '18', '20', '21']
61+
ghc-version: ['9.4.8']
6662
steps:
6763
- name: 📥 Checkout repository
6864
uses: actions/checkout@v5
@@ -79,51 +75,67 @@ jobs:
7975
cd ${{ matrix.package }}
8076
cabal check
8177
82-
- name: 💾 Generate sdist
83-
run: |
84-
cd ${{ matrix.package }}
85-
cabal sdist
78+
sdist-build:
79+
name: Build from sdist (ubuntu-latest, GHC ${{ matrix.ghc }}, LLVM ${{ matrix.llvm }})
80+
runs-on: ubuntu-latest
81+
strategy:
82+
matrix:
83+
cabal-version: ['3.16']
84+
ghc-version: ['9.2.8', '9.4.8', '9.6.7', '9.8.4', '9.10.3', '9.12.2']
85+
llvm-version: ['14', '16', '18', '20', '21']
86+
steps:
87+
- name: 📥 Checkout repository
88+
uses: actions/checkout@v5
8689

87-
- name: 💾 Test sdist can be built
88-
run: |
89-
SDIST_FILE=$(find dist-newstyle/sdist -name "${{ matrix.package }}*.tar.gz" | head -1)
90-
if [[ -z "$SDIST_FILE" ]]; then
91-
echo "Error: sdist file not found"
92-
exit 1
93-
fi
90+
- name: 🛠️ Setup Haskell
91+
id: setup-haskell
92+
uses: haskell-actions/setup@v2
93+
with:
94+
ghc-version: ${{ matrix.ghc-version }}
95+
cabal-version: ${{ matrix.cabal-version }}
9496

95-
TEMP_DIR=$(mktemp -d)
96-
CURR_DIR=$(pwd)
97-
tar xzf "$SDIST_FILE" -C "$TEMP_DIR"
97+
- name: 🛠️ Setup LLVM/Clang
98+
uses: ./.github/actions/setup-llvm
99+
with:
100+
version: ${{ matrix.llvm-version }}
101+
102+
- name: 🛠️ cabal.project
103+
run: cp cabal.project.ci cabal.project
98104

99-
cp cabal.project.base $TEMP_DIR/*/
105+
- name: 💾 Generate all sdists
106+
run: cabal sdist all
100107

101-
cd $TEMP_DIR/*
108+
- name: 💾 Test all sdists can be built
109+
run: |
110+
TEMP_DIR=$(mktemp -d)
102111
103-
cat <<EOF >> cabal.project.base
104-
packages:
105-
$CURR_DIR/ansi-diff
106-
$CURR_DIR/c-expr-runtime
107-
$CURR_DIR/c-expr-dsl
108-
$CURR_DIR/hs-bindgen
109-
$CURR_DIR/hs-bindgen-runtime
110-
$CURR_DIR/hs-bindgen-test-runtime
111-
EOF
112+
# Extract all sdists
113+
for SDIST_FILE in dist-newstyle/sdist/*.tar.gz; do
114+
tar xzf "$SDIST_FILE" -C "$TEMP_DIR"
115+
done
112116
113-
cp cabal.project.base cabal.project.local
117+
cd "$TEMP_DIR"
114118
115-
cabal build --dry-run
119+
# Create cabal.project with all extracted packages
120+
echo "packages:" > cabal.project
121+
for dir in */; do
122+
echo " ${dir%/}" >> cabal.project
123+
done
124+
125+
cabal build all
116126
117127
# Build Haddock documentation for all packages
118128
build-haddock:
119-
name: Build Haddock
129+
name: Build Haddock (ubuntu-latest, GHC ${{ matrix.ghc-version }}, LLVM ${{ matrix.llvm-version }})
120130
runs-on: ubuntu-latest
121131
timeout-minutes: 30
122132
strategy:
123-
fail-fast: false
133+
fail-fast: true
124134
matrix:
125135
cabal-version: ['3.16']
126-
ghc-version: ['9.2.8', '9.4.8', '9.6.7', '9.8.4', '9.10.3', '9.12.2']
136+
# Doesn't run GHC 9.2.8 due to a haddock bug
137+
#
138+
ghc-version: [ '9.4.8', '9.6.7', '9.8.4', '9.10.3', '9.12.2']
127139
llvm-version: ['14', '16', '18', '20', '21']
128140
steps:
129141
- name: 📥 Checkout repository
@@ -158,7 +170,7 @@ jobs:
158170
restore-keys: ${{ env.key }}-
159171

160172
- name: 🛠️ Build dependencies with Haddock
161-
run: cabal haddock all --only-dependencies
173+
run: cabal build all --only-dependencies --enable-documentation
162174

163175
- name: 💾 Save Cabal dependencies
164176
uses: actions/cache/save@v4

0 commit comments

Comments
 (0)