Skip to content

Commit 8298772

Browse files
committed
Update and simplify workflow
rm redundant workflow fix fix
1 parent abe0838 commit 8298772

File tree

3 files changed

+59
-146
lines changed

3 files changed

+59
-146
lines changed

.github/workflows/haskell.yml

Lines changed: 57 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Haskell CI using Cabal
1+
name: Haskell CI
22

33
on:
44
push:
@@ -19,183 +19,96 @@ jobs:
1919
- os: macos-latest
2020
ghc: "8.10.7"
2121

22-
env:
23-
# we need the LD_LIBRARY_PATH env var here because we ended up installing libsecp256k1 into /usr/local,
24-
# pkg-config, *does* return the proper location, but the library does not appear to be properly referenced.
25-
# FIXME: this is arguably a bug, and pkg-config should return the right values!
26-
LD_LIBRARY_PATH: ${{ (matrix.os != 'windows-latest' && '/usr/local/lib') || '' }}
27-
2822
steps:
29-
- name: "WIN: Install System Dependencies via pacman (msys2)"
30-
if: runner.os == 'Windows'
31-
run: |
32-
# ghcup should be installed on current GHA Windows runners. Let's use ghcup to run
33-
# pacman, to install the necessary dependencies, ...
34-
ghcup run --mingw-path -- pacman --noconfirm -S `
35-
mingw-w64-x86_64-pkg-config `
36-
mingw-w64-x86_64-pcre `
37-
mingw-w64-x86_64-libsodium `
38-
base-devel `
39-
autoconf-wrapper `
40-
autoconf `
41-
automake `
42-
libtool `
43-
make
44-
45-
# this seems to break something. It _must_ come after the pacman setup
46-
# above. It appears as if PATHEXT is set _after_ ghcup install ghc/cabal, and
47-
# as such we'd need pacman.exe instead.
48-
- name: Setup Haskell
49-
if: runner.os == 'Linux'
50-
run: |
51-
# Use GHCUP to manage ghc/cabal
52-
ghcup install ghc --set ${{ matrix.ghc }}
53-
ghcup install cabal --set 3.10.1.0
54-
55-
ghc --version
56-
cabal --version
57-
58-
- name: "MAC: Setup Haskell"
59-
if: runner.os == 'macOS'
23+
- name: Install Haskell
6024
uses: input-output-hk/actions/haskell@latest
25+
id: setup-haskell
6126
with:
6227
ghc-version: ${{ matrix.ghc }}
6328
cabal-version: 3.12.1.0
6429

65-
- name: "WIN: fixup cabal config"
66-
if: runner.os == 'Windows'
67-
run: |
68-
# make sure cabal knows about msys64, and mingw64 tools. Not clear why C:/cabal/config is empty
69-
# and C:/cabal doesn't even exist. The ghcup bootstrap file should have create it in the image:
70-
# See https://github.com/haskell/ghcup-hs/blob/787edc17af4907dbc51c85e25c490edd8d68b80b/scripts/bootstrap/bootstrap-haskell#L591
71-
# So we'll do it by hand here for now.
72-
#
73-
# We'll _not_ add extra-include-dirs, or extra-lib-dirs, and rely on what's shipped with GHC.
74-
# https://github.com/msys2/MINGW-packages/issues/10837#issuecomment-1047105402
75-
# https://gitlab.haskell.org/ghc/ghc/-/issues/21111
76-
# if we _do_ want them, this would be the lines to add below
77-
78-
$ghcMingwDir = Join-Path -Path $(ghc --print-libdir) `
79-
-ChildPath ../mingw/x86_64-*-mingw32/lib/ `
80-
-Resolve
81-
82-
cabal user-config -a "extra-prog-path: C:/msys64/mingw64/bin, C:/msys64/usr/bin" `
83-
-a "extra-include-dirs: C:/msys64/mingw64/include" `
84-
-a ("extra-lib-dirs: {0}, C:/msys64/mingw64/lib" -f $ghcMingwDir) `
85-
-f init
86-
87-
- name: Set cache version
88-
run: echo "CACHE_VERSION=grFfw7r" >> $GITHUB_ENV
89-
90-
- uses: actions/checkout@v2
91-
92-
- name: "[PowerShell] Add build script path"
93-
if: runner.os == 'Windows'
94-
shell: pwsh
95-
run: Add-Content $env:GITHUB_PATH "$(pwd)/.github/bin"
96-
97-
- name: "[Bash] Add build script path"
98-
if: runner.os != 'Windows'
99-
run: echo "$(pwd)/.github/bin" >> $GITHUB_PATH
100-
101-
- name: "LINUX: Install build environment (apt-get)"
102-
if: runner.os == 'Linux'
103-
run: |
104-
sudo apt-get update
105-
sudo apt-get -y install libsodium23 libsodium-dev
106-
sudo apt-get -y remove --purge software-properties-common
107-
sudo apt-get -y autoremove
108-
109-
- name: "MAC: Install build environment (brew)"
110-
if: runner.os == 'macOS'
111-
run: |
112-
brew reinstall libsodium
113-
brew install pcre
30+
- uses: actions/checkout@v4
11431

11532
- name: Cabal update
11633
run: cabal update
11734

118-
- name: "Setup cabal-store"
119-
id: cabal-store
120-
shell: bash
121-
run: |
122-
cabal_config_file="$(cabal help user-config | tail -n 1 | xargs)"
123-
124-
if [[ '${{ runner.os }}' != 'Windows' ]]; then
125-
echo "cabal-store=$(dirname "$cabal_config_file")/store" | tee -a "$GITHUB_OUTPUT"
126-
else
127-
echo "cabal-store=C:\\cabal\\store" | tee -a "$GITHUB_OUTPUT"
128-
fi
129-
130-
- name: "Check cabal-store"
131-
shell: bash
132-
run: echo '${{ steps.cabal-store.outputs.cabal-store }}'
133-
13435
- name: Configure build
13536
shell: bash
13637
run: |
137-
if [ "${{github.event.inputs.tests}}" == "all" ]; then
138-
echo "Reconfigure cabal projects to run tests for all dependencies"
139-
sed -i 's|tests: False|tests: True|g' cabal.project
140-
fi
141-
14238
cp ".github/workflows/cabal.project.local.ci.$(uname -s)" cabal.project.local
143-
14439
echo "# cabal.project.local"
14540
cat cabal.project.local
14641
42+
# A dry run `build all` operation does *NOT* download anything, it just looks at the package
43+
# indices to generate an install plan.
44+
- name: Build dry run
45+
run: cabal build all --enable-tests --dry-run --minimize-conflict-set
46+
47+
# From the install plan a dependency list is generated here.
14748
- name: Record dependencies
14849
id: record-deps
14950
run: |
150-
cabal build all --dry-run
51+
# The tests call out to msys2 commands. We generally do not want to mix toolchains, so
52+
# we are very deliberate about only adding msys64 to the path where absolutely necessary.
53+
${{ (runner.os == 'Windows' && '$env:PATH=("C:\msys64\mingw64\bin;{0}" -f $env:PATH)') || '' }}
15154
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
15255
153-
- name: "OUTPUT Record weeknum"
154-
shell: bash
155-
run: echo "weeknum=$(/usr/bin/date -u "+%W")" >> $GITHUB_OUTPUT
156-
157-
- name: Cache Cabal store
158-
uses: actions/cache@v4
159-
with:
160-
path: ${{ steps.cabal-store.outputs.cabal-store }}
161-
key: cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
162-
restore-keys: |
163-
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
164-
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
165-
166-
- name: "Cache `dist-newstyle`"
167-
uses: actions/cache@v4
56+
# From the dependency list the cached dependencies is restored.
57+
# The hash of `dependencies.txt` is used as a part of the cache key because that will be stable
58+
# until the `index-state` values in the `cabal.project` file changes.
59+
- name: Restore cached dependencies
60+
uses: actions/cache/restore@v4
61+
id: cache
16862
with:
16963
path: |
64+
${{ steps.setup-haskell.outputs.cabal-store }}
17065
dist-newstyle
171-
!dist-newstyle/**/.git
172-
key: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ steps.record-deps.outputs.weeknum }}
173-
restore-keys: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
66+
key: cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
17467

68+
# The dependencies are installed. If the cache is found and restored in the previous step,
69+
# this should be a no-op. If the cache key is not found the build assets are produced for the
70+
# caching in the next step.
17571
- name: Install dependencies
176-
run: cabal build all --only-dependencies
72+
run: cabal build all --enable-tests --only-dependencies -j --ghc-option=-j4
17773

178-
- name: Build
179-
run: cabal build all
74+
# Always store the cabal cache.
75+
# This may benignly fail if the cache key is already populated.
76+
- name: Cache Cabal store
77+
uses: actions/cache/save@v4
78+
with:
79+
path: |
80+
${{ steps.setup-haskell.outputs.cabal-store }}
81+
dist-newstyle
82+
key: cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
18083

181-
- name: Run unit tests
182-
shell: bash
84+
- name: Build Windows
85+
if: runner.os == 'Windows'
86+
id: build-step-windows
18387
run: |
184-
if [ "${{ runner.os }}" != "Windows" ] || [ "${{ matrix.ghc }}" != "9.6.5" ]; then
185-
# This test is currently broken with GHC 9.6 on windows.
186-
# This could be related to:
187-
# * UTF8 encoding and the use of emoji's in the output.
188-
# * unhandled PEi386 relocation type 14 (less likely).
189-
cabal test
190-
fi
88+
cabal build all --enable-tests -j --ghc-option=-j4
89+
90+
if ( "${{ runner.os }}" -eq "Windows" ) {
91+
echo "exe-location=D:\a\cardano-addresses\cardano-addresses\dist-newstyle\build\x86_64-windows\ghc-${{ matrix.ghc }}\cardano-addresses-4.0.0\x\cardano-address\build\cardano-address\cardano-address.exe" >> $env:GITHUB_OUTPUT
92+
}
93+
94+
- name: Build Linux/Macos
95+
if: runner.os != 'Windows'
96+
run: cabal build all --enable-tests -j --ghc-option=-j4
97+
98+
- name: Running all tests
99+
env:
100+
# these two are msys2 env vars, they have no effect on non-msys2 installs.
101+
MSYS2_PATH_TYPE: inherit
102+
MSYSTEM: MINGW64
103+
run: cabal test all --enable-tests --test-show-details=direct -j1
191104

192105
- name: Upload Windows artifact
193106
uses: actions/upload-artifact@v4
194107
if: runner.os == 'Windows'
195108
with:
196109
name: cardano-address-${{ matrix.os }}-${{ matrix.ghc }}-exe
197-
path: ${{ steps.cabal-store.outputs.cabal-store }}
198-
retention-days: 2
110+
path: ${{ steps.build-step-windows.outputs.exe-location }}
111+
retention-days: 1
199112

200113
- name: Preparing Linux/Macos artifact
201114
if: runner.os != 'Windows'
@@ -219,9 +132,9 @@ jobs:
219132
echo "artifactPath=artifacts/$(artifactName)" >> $GITHUB_ENV
220133
221134
- name: Upload Linux/Macos artifact
222-
uses: actions/upload-artifact@v4
223135
if: runner.os != 'Windows'
136+
uses: actions/upload-artifact@v4
224137
with:
225138
name: cardano-address-${{ matrix.os }}-${{ matrix.ghc }}
226139
path: ${{ env.artifactPath }}
227-
retention-days: 2
140+
retention-days: 1

ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
## [4.0.0] - 2025-01-30
1+
## [4.0.0] - 2025-01-31
22

33
### Added
44

5+
- Unify core and command-line packages into one
56
- Drop JavaScript support and get rid of JavaScript codebase
67
- CIP-0129 support added, affecting `cardano-address key hash` and `cardano-address script hash`
78
- CIP-0129 support with backward compatibility added, affecting `cardano-address key hash` and `cardano-address script hash`

release.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ let
4343
let ps = jobs.packages.${defaultSystem}; in
4444
[
4545
ps."cardano-addresses:exe:cardano-address"
46-
ps."js-unknown-ghcjs:cardano-addresses:lib:cardano-addresses"
4746
]
4847
)
4948
++ (lib.optionals linuxBuild (

0 commit comments

Comments
 (0)