Skip to content

Commit 1e4ebd2

Browse files
committedMay 3, 2024··
add github build action
1 parent c19e622 commit 1e4ebd2

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
 

Diff for: ‎.github/workflows/build.yaml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Build
2+
3+
concurrency:
4+
group: ${{ github.ref }}-build
5+
cancel-in-progress: true
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- master
11+
paths:
12+
- package.yaml
13+
- stack.yaml
14+
- stack.yaml.lock
15+
- "src/**/*.hs"
16+
- "test/**/*.hs"
17+
- ".github/workflows/build.yaml"
18+
types:
19+
- synchronize
20+
- opened
21+
- reopened
22+
- ready_for_review
23+
push:
24+
branches:
25+
- master
26+
paths:
27+
- package.yaml
28+
- stack.yaml
29+
- stack.yaml.lock
30+
- "src/**/*.hs"
31+
- "test/**/*.hs"
32+
- ".github/workflows/build.yaml"
33+
workflow_dispatch:
34+
inputs: {}
35+
36+
jobs:
37+
build:
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
os:
42+
- ubuntu-latest
43+
- macOS-latest
44+
- windows-latest
45+
46+
name: Build
47+
runs-on: ${{ matrix.os }}
48+
steps:
49+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
50+
name: Checkout
51+
52+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
53+
name: Checkout bitcoin-core/secp256k1
54+
with:
55+
repository: bitcoin-core/secp256k1
56+
ref: 1ad5185cd42c0636104129fcc9f6a4bf9c67cc40
57+
path: lib/secp256k1
58+
59+
- uses: haskell-actions/setup@64aa5146ed5bd91f181552b8b5fbe50fbd2bd3fe
60+
name: Setup Haskell
61+
id: setup-haskell
62+
with:
63+
enable-stack: true
64+
stack-no-global: true
65+
66+
- name: Cache
67+
id: cache
68+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
69+
with:
70+
path: |
71+
${{ steps.setup-haskell.outputs.stack-root }}
72+
key: ${{ runner.os }}-${{ hashFiles('**/package.yaml', '**/stack.yaml', '**/stack.yaml.lock') }}
73+
restore-keys: |
74+
${{ runner.os }}-
75+
76+
- name: Install buildtools (MacOS)
77+
if: matrix.os == 'macOS-latest'
78+
run: |
79+
brew install automake libtool
80+
81+
- name: Install libsecp256k1 (Unix)
82+
if: matrix.os != 'windows-latest'
83+
working-directory: ./lib/secp256k1
84+
run: |
85+
./autogen.sh
86+
./configure --enable-module-schnorrsig --enable-module-recovery
87+
make
88+
make check
89+
sudo make install
90+
echo "LD_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV
91+
92+
- name: Install libsecp256k1 (Windows)
93+
if: matrix.os == 'windows-latest'
94+
working-directory: ./lib/secp256k1
95+
run: |
96+
pacman --noconfirm -Sy msys2-keyring
97+
pacman --noconfirm -S mingw-w64-x86_64-pkg-config
98+
pacman --noconfirm -S mingw-w64-x86_64-autotools
99+
cmake -S . -B build -G "Unix Makefiles" \
100+
-DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-w64-mingw32.toolchain.cmake \
101+
-DCMAKE_BUILD_TYPE=Release \
102+
-DCMAKE_INSTALL_PREFIX=/mingw64 \
103+
-DSECP256K1_ENABLE_MODULE_RECOVERY=ON
104+
cmake --build build --target all
105+
cmake --build build --target test
106+
cmake --build build --target install
107+
shell: stack exec -- bash {0}
108+
109+
- name: Install dependencies
110+
run: |
111+
stack build --test --only-dependencies
112+
113+
- name: Build
114+
id: build
115+
run: |
116+
stack build --test --no-run-tests --no-run-benchmarks
117+
118+
- name: Test
119+
run: |
120+
stack build --test

0 commit comments

Comments
 (0)
Please sign in to comment.