Skip to content

Commit ff2038c

Browse files
committed
Switch to github
Added workflow, and nix files
1 parent ea7df2f commit ff2038c

16 files changed

Lines changed: 1299 additions & 211 deletions

.github/workflows/haskell-ci.yml

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' 'cabal.project'
4+
#
5+
# To regenerate the script (for example after adjusting tested-with) run
6+
#
7+
# haskell-ci regenerate
8+
#
9+
# For more information, see https://github.com/haskell-CI/haskell-ci
10+
#
11+
# version: 0.19.20260331
12+
#
13+
# REGENDATA ("0.19.20260331",["github","cabal.project"])
14+
#
15+
name: Haskell-CI
16+
on:
17+
- push
18+
- pull_request
19+
- merge_group
20+
- workflow_dispatch
21+
jobs:
22+
linux:
23+
name: Haskell-CI - Linux - ${{ matrix.compiler }}
24+
runs-on: ubuntu-24.04
25+
timeout-minutes:
26+
60
27+
container:
28+
image: buildpack-deps:jammy
29+
continue-on-error: ${{ matrix.allow-failure }}
30+
strategy:
31+
matrix:
32+
include:
33+
- compiler: ghc-9.14.1
34+
compilerKind: ghc
35+
compilerVersion: 9.14.1
36+
setup-method: ghcup
37+
allow-failure: false
38+
- compiler: ghc-9.12.4
39+
compilerKind: ghc
40+
compilerVersion: 9.12.4
41+
setup-method: ghcup
42+
allow-failure: false
43+
- compiler: ghc-9.10.3
44+
compilerKind: ghc
45+
compilerVersion: 9.10.3
46+
setup-method: ghcup
47+
allow-failure: false
48+
- compiler: ghc-9.8.4
49+
compilerKind: ghc
50+
compilerVersion: 9.8.4
51+
setup-method: ghcup
52+
allow-failure: false
53+
- compiler: ghc-9.6.7
54+
compilerKind: ghc
55+
compilerVersion: 9.6.7
56+
setup-method: ghcup
57+
allow-failure: false
58+
fail-fast: false
59+
steps:
60+
- name: apt-get install
61+
run: |
62+
apt-get update
63+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
64+
- name: Install GHCup
65+
run: |
66+
mkdir -p "$HOME/.ghcup/bin"
67+
curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup"
68+
chmod a+x "$HOME/.ghcup/bin/ghcup"
69+
- name: Install cabal-install
70+
run: |
71+
"$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
72+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
73+
- name: Install GHC (GHCup)
74+
if: matrix.setup-method == 'ghcup'
75+
run: |
76+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
77+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
78+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
79+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
80+
echo "HC=$HC" >> "$GITHUB_ENV"
81+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
82+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
83+
env:
84+
HCKIND: ${{ matrix.compilerKind }}
85+
HCNAME: ${{ matrix.compiler }}
86+
HCVER: ${{ matrix.compilerVersion }}
87+
- name: Set PATH and environment variables
88+
run: |
89+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
90+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
91+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
92+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
93+
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
94+
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
95+
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
96+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
97+
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
98+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
99+
env:
100+
HCKIND: ${{ matrix.compilerKind }}
101+
HCNAME: ${{ matrix.compiler }}
102+
HCVER: ${{ matrix.compilerVersion }}
103+
- name: env
104+
run: |
105+
env
106+
- name: write cabal config
107+
run: |
108+
mkdir -p $CABAL_DIR
109+
cat >> $CABAL_CONFIG <<EOF
110+
remote-build-reporting: anonymous
111+
write-ghc-environment-files: never
112+
remote-repo-cache: $CABAL_DIR/packages
113+
logs-dir: $CABAL_DIR/logs
114+
world-file: $CABAL_DIR/world
115+
extra-prog-path: $CABAL_DIR/bin
116+
symlink-bindir: $CABAL_DIR/bin
117+
installdir: $CABAL_DIR/bin
118+
build-summary: $CABAL_DIR/logs/build.log
119+
store-dir: $CABAL_DIR/store
120+
install-dirs user
121+
prefix: $CABAL_DIR
122+
repository hackage.haskell.org
123+
url: http://hackage.haskell.org/
124+
EOF
125+
cat >> $CABAL_CONFIG <<EOF
126+
program-default-options
127+
ghc-options: $GHCJOBS +RTS -M3G -RTS
128+
EOF
129+
cat $CABAL_CONFIG
130+
- name: versions
131+
run: |
132+
$HC --version || true
133+
$HC --print-project-git-commit-id || true
134+
$CABAL --version || true
135+
- name: update cabal index
136+
run: |
137+
$CABAL v2-update -v
138+
- name: install cabal-plan
139+
run: |
140+
mkdir -p $HOME/.cabal/bin
141+
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
142+
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
143+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
144+
rm -f cabal-plan.xz
145+
chmod a+x $HOME/.cabal/bin/cabal-plan
146+
cabal-plan --version
147+
- name: checkout
148+
uses: actions/checkout@v5
149+
with:
150+
path: source
151+
- name: initial cabal.project for sdist
152+
run: |
153+
touch cabal.project
154+
echo "packages: $GITHUB_WORKSPACE/source/cas-store" >> cabal.project
155+
echo "packages: $GITHUB_WORKSPACE/source/cas-hashable" >> cabal.project
156+
echo "packages: $GITHUB_WORKSPACE/source/cas-hashable-s3" >> cabal.project
157+
cat cabal.project
158+
- name: sdist
159+
run: |
160+
mkdir -p sdist
161+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
162+
- name: unpack
163+
run: |
164+
mkdir -p unpacked
165+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
166+
- name: generate cabal.project
167+
run: |
168+
PKGDIR_cas_store="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/cas-store-[0-9.]*')"
169+
echo "PKGDIR_cas_store=${PKGDIR_cas_store}" >> "$GITHUB_ENV"
170+
PKGDIR_cas_hashable="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/cas-hashable-[0-9.]*')"
171+
echo "PKGDIR_cas_hashable=${PKGDIR_cas_hashable}" >> "$GITHUB_ENV"
172+
PKGDIR_cas_hashable_s3="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/cas-hashable-s3-[0-9.]*')"
173+
echo "PKGDIR_cas_hashable_s3=${PKGDIR_cas_hashable_s3}" >> "$GITHUB_ENV"
174+
rm -f cabal.project cabal.project.local
175+
touch cabal.project
176+
touch cabal.project.local
177+
echo "packages: ${PKGDIR_cas_store}" >> cabal.project
178+
echo "packages: ${PKGDIR_cas_hashable}" >> cabal.project
179+
echo "packages: ${PKGDIR_cas_hashable_s3}" >> cabal.project
180+
echo "package cas-store" >> cabal.project
181+
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
182+
echo "package cas-hashable" >> cabal.project
183+
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
184+
echo "package cas-hashable-s3" >> cabal.project
185+
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
186+
echo "package cas-store" >> cabal.project
187+
echo " ghc-options: -Werror=unused-packages" >> cabal.project
188+
echo "package cas-hashable" >> cabal.project
189+
echo " ghc-options: -Werror=unused-packages" >> cabal.project
190+
echo "package cas-hashable-s3" >> cabal.project
191+
echo " ghc-options: -Werror=unused-packages" >> cabal.project
192+
echo "package cas-store" >> cabal.project
193+
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
194+
echo "package cas-hashable" >> cabal.project
195+
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
196+
echo "package cas-hashable-s3" >> cabal.project
197+
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
198+
cat >> cabal.project <<EOF
199+
EOF
200+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(cas-hashable|cas-hashable-s3|cas-store)$/; }' >> cabal.project.local
201+
cat cabal.project
202+
cat cabal.project.local
203+
- name: dump install plan
204+
run: |
205+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
206+
cabal-plan
207+
- name: restore cache
208+
uses: actions/cache/restore@v4
209+
with:
210+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
211+
path: ~/.cabal/store
212+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
213+
- name: install dependencies
214+
run: |
215+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
216+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
217+
- name: build w/o tests
218+
run: |
219+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
220+
- name: build
221+
run: |
222+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
223+
- name: tests
224+
run: |
225+
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
226+
- name: cabal check
227+
run: |
228+
cd ${PKGDIR_cas_store} || false
229+
${CABAL} -vnormal check
230+
cd ${PKGDIR_cas_hashable} || false
231+
${CABAL} -vnormal check
232+
cd ${PKGDIR_cas_hashable_s3} || false
233+
${CABAL} -vnormal check
234+
- name: haddock
235+
run: |
236+
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
237+
- name: unconstrained build
238+
run: |
239+
rm -f cabal.project.local
240+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
241+
- name: save cache
242+
if: always()
243+
uses: actions/cache/save@v4
244+
with:
245+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
246+
path: ~/.cabal/store

.github/workflows/nix.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Check and build using (Nix)
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
tags:
8+
- "v*.*.*"
9+
pull_request:
10+
branches:
11+
- "*"
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
16+
17+
jobs:
18+
build_and_test_nix:
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
22+
ghc: ["967", "984", "9103", "9122", "9141"]
23+
name: Test and build canonical-ledger-state using Nix
24+
runs-on: ${{ matrix.os }}
25+
steps:
26+
- name: git checkout
27+
uses: actions/checkout@v6
28+
- uses: cachix/install-nix-action@v31
29+
with:
30+
nix_path: nixpkgs=channel:nixos-unstable
31+
extra_nix_config: |
32+
experimental-features = nix-command flakes
33+
accept-flake-config = true
34+
- uses: cachix/cachix-action@v16
35+
with:
36+
name: cas-store
37+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
38+
- name: Run `nix build`
39+
run: |
40+
nix build \
41+
'.#"ghc${{ matrix.ghc }}:cas-store:lib:cas-store"' \
42+
'.#"ghc${{ matrix.ghc }}:cas-hashable:lib:cas-hashable"' \
43+
'.#"ghc${{ matrix.ghc }}:cas-hashable-s3:lib:cas-hashable-s3"'
44+
- name: Run tests
45+
run: |
46+
current_system=$(nix eval --impure --expr 'builtins.currentSystem')
47+
nix build \
48+
".#checks.${current_system}.ghc${{ matrix.ghc }}:cas-store:test:unit-tests"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist-newstyle
2+
result

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/nix/store/cg9dqlv5awxw2psb7m09rhgb0vdsg6z7-pre-commit-config.json

0 commit comments

Comments
 (0)