-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
81 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# I don't understand why this just vanishes. | ||
export PATH=/usr/bin:$PATH | ||
|
||
echo ======== | ||
echo $PATH | ||
echo ======== | ||
git clone https://github.com/bitcoin-core/secp256k1 | ||
cd secp256k1 | ||
git switch $SECP256K1_REF --detach | ||
./autogen.sh | ||
./configure $CI_SECP_FLAGS --enable-module-schnorrsig --enable-experimental | ||
make | ||
make check | ||
$CI_SECP_INSTALL_CMD make install | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,6 @@ jobs: | |
build: | ||
runs-on: ${{ matrix.os }} | ||
|
||
defaults: | ||
run: | ||
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -39,25 +35,6 @@ jobs: | |
PKG_CONFIG_PATH: ${{ matrix.os == 'macos-latest' && '/usr/local/opt/[email protected]/lib/pkgconfig' || '' }} | ||
|
||
steps: | ||
|
||
- name: "WIN: Setup MSYS2 and libraries" | ||
if: runner.os == 'Windows' | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
update: true | ||
install: >- | ||
base-devel | ||
autoconf-wrapper | ||
autoconf | ||
automake | ||
libtool | ||
make | ||
git | ||
mingw-w64-x86_64-pkg-config | ||
mingw-w64-x86_64-toolchain | ||
mingw-w64-x86_64-libsodium | ||
mingw-w64-x86_64-jq | ||
- name: "LINUX,MAC: Setup haskell" | ||
if: runner.os != 'Windows' | ||
uses: haskell/actions/setup@v1 | ||
|
@@ -66,45 +43,78 @@ jobs: | |
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: 3.8.1.0 | ||
|
||
- name: "WIN: Setup Haskell" | ||
id: win-setup-haskell | ||
- name: "WIN: Install ghcup" | ||
if: runner.os == 'Windows' | ||
run: | | ||
# see https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/scripts/bootstrap/bootstrap-haskell | ||
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ | ||
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ | ||
BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=1 \ | ||
BOOTSTRAP_HASKELL_ADJUST_BASHRC=1 \ | ||
BOOTSTRAP_HASKELL_GHC_VERSION="${{ matrix.ghc }}" \ | ||
BOOTSTRAP_HASKELL_CABAL_VERSION="3.6.2.0" \ | ||
sh | ||
# MSYS2 doesn't inherit $GITHUB_PATH so this is needed | ||
cat <(echo "source /c/ghcup/env") ~/.bashrc > ~/.bashrc.new | ||
mv ~/.bashrc.new ~/.bashrc | ||
source ~/.bashrc | ||
# There is an issue with crt libraries, fixed by prepending the ghc | ||
# mingw32 libraries directory to every other library directory. | ||
echo "# Original cabal config extra-lib-dirs" | ||
grep extra-lib-dirs /c/cabal/config | ||
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 | ||
echo "# Modified cabal config extra-lib-dirs" | ||
grep extra-lib-dirs /c/cabal/config | ||
# ghcup should be installed on current GHA Windows runners. Let's use ghcup to run | ||
# pacman, to install the necessary dependencies, ... | ||
ghcup run -- pacman --noconfirm -S ` | ||
mingw-w64-x86_64-pkg-config ` | ||
mingw-w64-x86_64-libsodium ` | ||
base-devel ` | ||
autoconf-wrapper ` | ||
autoconf ` | ||
automake ` | ||
libtool ` | ||
make | ||
# ... and also the ghc and cabal combination we want. | ||
ghcup install ghc --set ${{ matrix.ghc }} | ||
ghcup install cabal --set 3.6.2.0 | ||
ghc --version | ||
cabal --version | ||
echo "cabal-store=$(cabal --help | tail -1 | tr -d ' ' | rev | cut -d '/' -f2- | rev)\\store" >> $GITHUB_OUTPUT | ||
# make sure cabal knows about msys64, and mingw64 tools. Not clear why C:/cabal/config is empty | ||
# and C:/cabal doesn't even exist. The ghcup bootstrap file should have create it in the image: | ||
# See https://github.com/haskell/ghcup-hs/blob/787edc17af4907dbc51c85e25c490edd8d68b80b/scripts/bootstrap/bootstrap-haskell#L591 | ||
# So we'll do it by hand here for now. | ||
# | ||
# We'll _not_ add extra-include-dirs, or extra-lib-dirs, and rely on what's shipped with GHC. | ||
# https://github.com/msys2/MINGW-packages/issues/10837#issuecomment-1047105402 | ||
# https://gitlab.haskell.org/ghc/ghc/-/issues/21111 | ||
# if we _do_ want them, this would be the lines to add below | ||
$ghcMingwDir = Join-Path -Path $(ghc --print-libdir) ` | ||
-ChildPath ../mingw/x86_64-*-mingw32/lib/ ` | ||
-Resolve | ||
cabal user-config -a "extra-prog-path: C:/msys64/mingw64/bin, C:/msys64/usr/bin" ` | ||
-a "extra-include-dirs: C:/msys64/mingw64/include" ` | ||
-a ("extra-lib-dirs: {0}, C:/msys64/mingw64/lib" -f $ghcMingwDir) ` | ||
-f init | ||
- name: "OUTPUT Record cabal-store" | ||
id: win-setup-haskell | ||
shell: bash | ||
if: runner.os == 'Windows' | ||
run: echo "cabal-store=$(dirname $(cabal --help | tail -1 | tr -d ' '))\\store" >> $GITHUB_OUTPUT | ||
|
||
- name: Set cache version | ||
run: echo "CACHE_VERSION=grFfw8r" >> $GITHUB_ENV | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
|
||
# TODO: this really should come from a pre-built location | ||
- name: "WIN: Install secp256k1" | ||
if: runner.os == 'Windows' | ||
# Same env as tmate action | ||
env: | ||
MSYS2_PATH_TYPE: inherit | ||
MSYSTEM: MINGW64 | ||
CHERE_INVOKING: 1 | ||
# install secp into /mingw64 prefix, which is where pkg-config will look | ||
# by default. | ||
CI_SECP_FLAGS: "--prefix=/mingw64" | ||
run: C:\\msys64\\usr\\bin\\bash.exe .github/workflows/build-secp256k1.bash | ||
|
||
- name: "LINUX: Install secp256k1" | ||
if: runner.os != 'Windows' | ||
env: | ||
CI_SECP_FLAGS: "--prefix=/usr" | ||
CI_SECP_INSTALL_CMD: sudo | ||
run: bash .github/workflows/build-secp256k1.bash | ||
|
||
- name: Add build script path | ||
shell: bash | ||
run: | | ||
if [ "${{ runner.os }}" == "Windows" ]; then | ||
# MSYS2 doesn't inherit $GITHUB_PATH, so this workaround is needed | ||
|
@@ -126,10 +136,7 @@ jobs: | |
- name: "LINUX: Install build environment (for secp256k1)" | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get -y install autoconf automake libtool | ||
echo "CI_SECP_FLAGS=--prefix=/usr" >> $GITHUB_ENV | ||
echo "CI_SECP_INSTALL_CMD=sudo" >> $GITHUB_ENV | ||
run: sudo apt-get -y install autoconf automake libtool | ||
|
||
- name: "MAC: Install build environment (brew)" | ||
if: runner.os == 'macOS' | ||
|
@@ -140,34 +147,6 @@ jobs: | |
if: runner.os == 'macOS' | ||
run: brew install autoconf automake libtool | ||
|
||
- name: "Install secp256k1" | ||
run: | | ||
git clone https://github.com/bitcoin-core/secp256k1.git | ||
( cd secp256k1 | ||
git reset --hard $SECP256K1_REF | ||
./autogen.sh | ||
./configure $CI_SECP_FLAGS --enable-module-schnorrsig --enable-experimental | ||
make | ||
make check | ||
$CI_SECP_INSTALL_CMD make install | ||
) | ||
- name: "List all pkg-config packages" | ||
run: | | ||
if [ "${{ runner.os }}" == "macOS" ]; then | ||
echo "=== Not printing every package detail in MacOS" | ||
# due to the location of the installed libraries this fails on MacOS with stuff not related to us | ||
else | ||
echo "=== Package list ===" | ||
pkg-config --list-all | ||
echo "=== Package details ===" | ||
for x in $(pkg-config --list-all | cut -d ' ' -f 1); do | ||
echo "# $x" | ||
pkg-config "$x" --cflags --libs | ||
done | ||
fi | ||
- name: Cabal update | ||
run: retry 2 cabal update | ||
|
||
|
@@ -188,8 +167,10 @@ jobs: | |
run: | | ||
cabal build all --dry-run | ||
cat ${{ env.PLAN_JSON }} | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt | ||
date > date.txt | ||
echo "weeknum=$(/bin/date -u "+%W")" >> $GITHUB_OUTPUT | ||
- name: "OUTPUT Record weeknum" | ||
shell: bash | ||
run: echo "weeknum=$(/usr/bin/date -u "+%W")" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache Cabal store | ||
uses: actions/cache@v2 | ||
|