Skip to content

Commit 5649897

Browse files
authored
Merge pull request #759 from IntersectMBO/jdral/check-release-script
Add a script that can be used to check release builds
2 parents 0878df6 + 57d21c4 commit 5649897

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Check release builds
2+
3+
on:
4+
push:
5+
tags:
6+
- blockio-*
7+
- bloomfilter-blocked-*
8+
- lsm-tree-*
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
# Set the default shell on all platforms.
18+
defaults:
19+
run:
20+
shell: sh
21+
22+
jobs:
23+
################################################################################
24+
# Build
25+
################################################################################
26+
build:
27+
name: |
28+
${{ format(
29+
'Check release build on {0}{1}{2}',
30+
startsWith(matrix.os, 'ubuntu-') && 'Linux' || startsWith(matrix.os, 'macOS-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows',
31+
matrix.ghc-version && format(' with GHC {0}', matrix.ghc-version),
32+
matrix.cabal-version && format(' and Cabal {0}', matrix.cabal-version)
33+
)
34+
}}
35+
runs-on: ${{ matrix.os }}
36+
timeout-minutes: 60
37+
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
42+
ghc-version: ["9.2", "9.4", "9.6", "9.8", "9.10", "9.12"]
43+
cabal-version: ["3.12"]
44+
45+
env:
46+
tag-name: ${{ github.ref_name }}
47+
release-build-target: |
48+
${{ startsWith(github.ref_name, 'blockio') && './blockio/blockio.cabal' || startsWith(github.ref_name, 'bloomfilter-blocked') && './bloomfilter-blocked/bloomfilter-blocked.cabal' || startsWith(github.ref_name, 'lsm-tree') && './lsm-tree.cabal' }}
49+
50+
steps:
51+
- name: 🗄️ Print release build target
52+
run: |
53+
echo ${{ env.tag-name }}
54+
echo ${{ env.release-build-target }}
55+
56+
- name: 📥 Checkout repository
57+
uses: actions/checkout@v4
58+
59+
- name: 🗄️ Print Job info
60+
run: |
61+
echo 'matrix.os: ${{ matrix.os }}'
62+
echo 'matrix.ghc-version: ${{ matrix.ghc-version }}'
63+
echo 'matrix.cabal-version: ${{ matrix.cabal-version }}'
64+
echo 'toJSON(matrix): ${{ toJSON(matrix) }}'
65+
66+
- name: 🛠️ Setup Haskell
67+
id: setup-haskell
68+
uses: haskell-actions/setup@v2
69+
with:
70+
ghc-version: ${{ matrix.ghc-version }}
71+
cabal-version: ${{ matrix.cabal-version }}
72+
73+
- name: 🛠️ Setup system dependencies (Linux)
74+
if: ${{ runner.os == 'Linux' }}
75+
run: sudo apt-get update && sudo apt-get -y install liburing-dev librocksdb-dev
76+
env:
77+
DEBIAN_FRONTEND: "noninteractive"
78+
79+
- name: 🛠️ Configure
80+
run: |
81+
echo "packages: ${{ env.release-build-target }}" > cabal.project.temp
82+
cabal configure \
83+
--project-file="cabal.project.temp" \
84+
--disable-tests \
85+
--disable-benchmarks \
86+
--index-state=HEAD \
87+
--ghc-options="-Werror"
88+
cat "cabal.project.temp.local"
89+
90+
- name: 💾 Generate Cabal plan
91+
run: |
92+
cabal build all \
93+
--project-file="cabal.project.temp" \
94+
--dry-run
95+
96+
- name: 💾 Restore Cabal dependencies
97+
uses: actions/cache/restore@v4
98+
if: ${{ !env.ACT }}
99+
id: cache-cabal
100+
env:
101+
key: check-release-build-${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-cabal-${{ steps.setup-haskell.outputs.cabal-version }}
102+
with:
103+
path: ${{ steps.setup-haskell.outputs.cabal-store }}
104+
key: ${{ env.key }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }}
105+
restore-keys: ${{ env.key }}-
106+
107+
- name: 🛠️ Build Cabal dependencies
108+
run: |
109+
cabal build all \
110+
--project-file="cabal.project.temp" \
111+
--only-dependencies
112+
113+
- name: 💾 Save Cabal dependencies
114+
uses: actions/cache/save@v4
115+
if: ${{ !env.ACT && steps.cache-cabal.outputs.cache-hit != 'true' }}
116+
with:
117+
path: ${{ steps.setup-haskell.outputs.cabal-store }}
118+
key: ${{ steps.cache-cabal.outputs.cache-primary-key }}
119+
120+
- name: 🏗️ Build
121+
run: |
122+
cabal build all \
123+
--project-file="cabal.project.temp"

0 commit comments

Comments
 (0)