Skip to content

Commit 45eb62e

Browse files
committed
add github build action
1 parent c19e622 commit 45eb62e

File tree

2 files changed

+242
-0
lines changed

2 files changed

+242
-0
lines changed

Diff for: .github/build.yaml

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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+
-DENABLE_MODULE_SCHNORRSIG=ON \
104+
-DENABLE_MODULE_RECOVERY=ON
105+
cmake --build build --target all
106+
cmake --build build --target test
107+
cmake --build build --target install
108+
shell: stack exec -- bash {0}
109+
110+
- name: Install dependencies
111+
run: |
112+
stack build --test --only-dependencies
113+
114+
- name: Build
115+
id: build
116+
run: |
117+
stack build --test --no-run-tests --no-run-benchmarks
118+
119+
- name: Test
120+
run: |
121+
stack build --test

Diff for: .github/workflows/build.yaml

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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+
-DENABLE_MODULE_SCHNORRSIG=ON \
104+
-DENABLE_MODULE_RECOVERY=ON
105+
cmake --build build --target all
106+
cmake --build build --target test
107+
cmake --build build --target install
108+
shell: stack exec -- bash {0}
109+
110+
- name: Install dependencies
111+
run: |
112+
stack build --test --only-dependencies
113+
114+
- name: Build
115+
id: build
116+
run: |
117+
stack build --test --no-run-tests --no-run-benchmarks
118+
119+
- name: Test
120+
run: |
121+
stack build --test

0 commit comments

Comments
 (0)