17
17
build :
18
18
runs-on : ${{ matrix.os }}
19
19
20
- defaults :
21
- run :
22
- shell : ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
23
-
24
20
strategy :
25
21
fail-fast : false
26
22
matrix :
39
35
PKG_CONFIG_PATH :
${{ matrix.os == 'macos-latest' && '/usr/local/opt/[email protected] /lib/pkgconfig' || '' }}
40
36
41
37
steps :
42
-
43
- - name : " WIN: Setup MSYS2 and libraries"
44
- if : runner.os == 'Windows'
45
- uses : msys2/setup-msys2@v2
46
- with :
47
- update : true
48
- install : >-
49
- base-devel
50
- autoconf-wrapper
51
- autoconf
52
- automake
53
- libtool
54
- make
55
- git
56
- mingw-w64-x86_64-pkg-config
57
- mingw-w64-x86_64-toolchain
58
- mingw-w64-x86_64-libsodium
59
- mingw-w64-x86_64-jq
60
-
61
38
- name : " LINUX,MAC: Setup haskell"
62
39
if : runner.os != 'Windows'
63
40
uses : haskell/actions/setup@v1
@@ -66,45 +43,78 @@ jobs:
66
43
ghc-version : ${{ matrix.ghc }}
67
44
cabal-version : 3.8.1.0
68
45
69
- - name : " WIN: Setup Haskell"
70
- id : win-setup-haskell
46
+ - name : " WIN: Install ghcup"
71
47
if : runner.os == 'Windows'
72
48
run : |
73
- # see https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/scripts/bootstrap/bootstrap-haskell
74
- curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
75
- BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
76
- BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=1 \
77
- BOOTSTRAP_HASKELL_ADJUST_BASHRC=1 \
78
- BOOTSTRAP_HASKELL_GHC_VERSION="${{ matrix.ghc }}" \
79
- BOOTSTRAP_HASKELL_CABAL_VERSION="3.6.2.0" \
80
- sh
81
-
82
- # MSYS2 doesn't inherit $GITHUB_PATH so this is needed
83
- cat <(echo "source /c/ghcup/env") ~/.bashrc > ~/.bashrc.new
84
- mv ~/.bashrc.new ~/.bashrc
85
-
86
- source ~/.bashrc
87
-
88
- # There is an issue with crt libraries, fixed by prepending the ghc
89
- # mingw32 libraries directory to every other library directory.
90
- echo "# Original cabal config extra-lib-dirs"
91
- grep extra-lib-dirs /c/cabal/config
92
-
93
- sed -i 's/C:\\msys64\\mingw64\\lib/C:\\ghcup\\ghc\\8.10.7\\mingw\\x86_64-w64-mingw32\\lib, C:\\msys64\\mingw64\\lib/g' /c/cabal/config
94
-
95
- echo "# Modified cabal config extra-lib-dirs"
96
- grep extra-lib-dirs /c/cabal/config
49
+ # ghcup should be installed on current GHA Windows runners. Let's use ghcup to run
50
+ # pacman, to install the necessary dependencies, ...
51
+ ghcup run -- pacman --noconfirm -S `
52
+ mingw-w64-x86_64-pkg-config `
53
+ mingw-w64-x86_64-libsodium `
54
+ base-devel `
55
+ autoconf-wrapper `
56
+ autoconf `
57
+ automake `
58
+ libtool `
59
+ make
60
+ # ... and also the ghc and cabal combination we want.
61
+ ghcup install ghc --set ${{ matrix.ghc }}
62
+ ghcup install cabal --set 3.6.2.0
97
63
98
64
ghc --version
99
65
cabal --version
100
- echo "cabal-store=$(cabal --help | tail -1 | tr -d ' ' | rev | cut -d '/' -f2- | rev)\\store" >> $GITHUB_OUTPUT
66
+ # make sure cabal knows about msys64, and mingw64 tools. Not clear why C:/cabal/config is empty
67
+ # and C:/cabal doesn't even exist. The ghcup bootstrap file should have create it in the image:
68
+ # See https://github.com/haskell/ghcup-hs/blob/787edc17af4907dbc51c85e25c490edd8d68b80b/scripts/bootstrap/bootstrap-haskell#L591
69
+ # So we'll do it by hand here for now.
70
+ #
71
+ # We'll _not_ add extra-include-dirs, or extra-lib-dirs, and rely on what's shipped with GHC.
72
+ # https://github.com/msys2/MINGW-packages/issues/10837#issuecomment-1047105402
73
+ # https://gitlab.haskell.org/ghc/ghc/-/issues/21111
74
+ # if we _do_ want them, this would be the lines to add below
75
+
76
+ $ghcMingwDir = Join-Path -Path $(ghc --print-libdir) `
77
+ -ChildPath ../mingw/x86_64-*-mingw32/lib/ `
78
+ -Resolve
79
+
80
+ cabal user-config -a "extra-prog-path: C:/msys64/mingw64/bin, C:/msys64/usr/bin" `
81
+ -a "extra-include-dirs: C:/msys64/mingw64/include" `
82
+ -a ("extra-lib-dirs: {0}, C:/msys64/mingw64/lib" -f $ghcMingwDir) `
83
+ -f init
84
+ - name : " OUTPUT Record cabal-store"
85
+ id : win-setup-haskell
86
+ shell : bash
87
+ if : runner.os == 'Windows'
88
+ run : echo "cabal-store=$(dirname $(cabal --help | tail -1 | tr -d ' '))\\store" >> $GITHUB_OUTPUT
101
89
102
90
- name : Set cache version
103
91
run : echo "CACHE_VERSION=grFfw8r" >> $GITHUB_ENV
104
92
105
93
- uses : actions/checkout@v2
106
94
95
+
96
+ # TODO: this really should come from a pre-built location
97
+ - name : " WIN: Install secp256k1"
98
+ if : runner.os == 'Windows'
99
+ # Same env as tmate action
100
+ env :
101
+ MSYS2_PATH_TYPE : inherit
102
+ MSYSTEM : MINGW64
103
+ CHERE_INVOKING : 1
104
+ # install secp into /mingw64 prefix, which is where pkg-config will look
105
+ # by default.
106
+ CI_SECP_FLAGS : " --prefix=/mingw64"
107
+ run : C:\\msys64\\usr\\bin\\bash.exe .github/workflows/build-secp256k1.bash
108
+
109
+ - name : " LINUX: Install secp256k1"
110
+ if : runner.os != 'Windows'
111
+ env :
112
+ CI_SECP_FLAGS : " --prefix=/usr"
113
+ CI_SECP_INSTALL_CMD : sudo
114
+ run : bash .github/workflows/build-secp256k1.bash
115
+
107
116
- name : Add build script path
117
+ shell : bash
108
118
run : |
109
119
if [ "${{ runner.os }}" == "Windows" ]; then
110
120
# MSYS2 doesn't inherit $GITHUB_PATH, so this workaround is needed
@@ -126,10 +136,7 @@ jobs:
126
136
127
137
- name : " LINUX: Install build environment (for secp256k1)"
128
138
if : runner.os == 'Linux'
129
- run : |
130
- sudo apt-get -y install autoconf automake libtool
131
- echo "CI_SECP_FLAGS=--prefix=/usr" >> $GITHUB_ENV
132
- echo "CI_SECP_INSTALL_CMD=sudo" >> $GITHUB_ENV
139
+ run : sudo apt-get -y install autoconf automake libtool
133
140
134
141
- name : " MAC: Install build environment (brew)"
135
142
if : runner.os == 'macOS'
@@ -140,34 +147,6 @@ jobs:
140
147
if : runner.os == 'macOS'
141
148
run : brew install autoconf automake libtool
142
149
143
- - name : " Install secp256k1"
144
- run : |
145
- git clone https://github.com/bitcoin-core/secp256k1.git
146
- ( cd secp256k1
147
- git reset --hard $SECP256K1_REF
148
- ./autogen.sh
149
- ./configure $CI_SECP_FLAGS --enable-module-schnorrsig --enable-experimental
150
- make
151
- make check
152
- $CI_SECP_INSTALL_CMD make install
153
- )
154
-
155
- - name : " List all pkg-config packages"
156
- run : |
157
- if [ "${{ runner.os }}" == "macOS" ]; then
158
- echo "=== Not printing every package detail in MacOS"
159
- # due to the location of the installed libraries this fails on MacOS with stuff not related to us
160
- else
161
- echo "=== Package list ==="
162
- pkg-config --list-all
163
-
164
- echo "=== Package details ==="
165
- for x in $(pkg-config --list-all | cut -d ' ' -f 1); do
166
- echo "# $x"
167
- pkg-config "$x" --cflags --libs
168
- done
169
- fi
170
-
171
150
- name : Cabal update
172
151
run : retry 2 cabal update
173
152
@@ -188,8 +167,10 @@ jobs:
188
167
run : |
189
168
cabal build all --dry-run
190
169
cat ${{ env.PLAN_JSON }} | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
191
- date > date.txt
192
- echo "weeknum=$(/bin/date -u "+%W")" >> $GITHUB_OUTPUT
170
+
171
+ - name : " OUTPUT Record weeknum"
172
+ shell : bash
173
+ run : echo "weeknum=$(/usr/bin/date -u "+%W")" >> $GITHUB_OUTPUT
193
174
194
175
- name : Cache Cabal store
195
176
uses : actions/cache@v2
0 commit comments