|
| 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 | + |
| 38 | + build: |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + os: |
| 43 | + - ubuntu-latest |
| 44 | + - macOS-latest |
| 45 | + - windows-latest |
| 46 | + |
| 47 | + name: Build |
| 48 | + runs-on: ${{ matrix.os }} |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b |
| 51 | + name: Checkout |
| 52 | + |
| 53 | + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b |
| 54 | + name: Checkout bitcoin-core/secp256k1 |
| 55 | + with: |
| 56 | + repository: bitcoin-core/secp256k1 |
| 57 | + ref: 694ce8fb2d1fd8a3d641d7c33705691d41a2a860 |
| 58 | + path: lib/secp256k1 |
| 59 | + |
| 60 | + - uses: haskell/actions/setup@f7b0997283589ea5a6b4f2ade6a239d70a412877 |
| 61 | + name: Setup Haskell |
| 62 | + id: setup-haskell |
| 63 | + with: |
| 64 | + enable-stack: true |
| 65 | + stack-no-global: true |
| 66 | + |
| 67 | + - name: Cache |
| 68 | + id: cache |
| 69 | + uses: actions/cache@56461b9eb0f8438fd15c7a9968e3c9ebb18ceff1 |
| 70 | + with: |
| 71 | + path: | |
| 72 | + ${{ steps.setup-haskell.outputs.stack-root }} |
| 73 | + key: ${{ runner.os }}-${{ hashFiles('**/package.yaml', '**/stack.yaml', '**/stack.yaml.lock') }} |
| 74 | + restore-keys: | |
| 75 | + ${{ runner.os }}- |
| 76 | +
|
| 77 | + - name: Install buildtools (MacOS) |
| 78 | + if: matrix.os == 'macOS-latest' |
| 79 | + run: brew install automake |
| 80 | + |
| 81 | + - name: Install libsecp256k1 (Unix) |
| 82 | + if: matrix.os != 'windows-latest' |
| 83 | + working-directory: ./lib/secp256k1 |
| 84 | + run: | |
| 85 | + ./autogen.sh |
| 86 | + ./configure |
| 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 | + ./autogen.sh |
| 100 | + ./configure --prefix=/mingw64 |
| 101 | + make |
| 102 | + make check |
| 103 | + make install |
| 104 | + shell: stack exec -- bash {0} |
| 105 | + |
| 106 | + - name: Install dependencies |
| 107 | + run: | |
| 108 | + stack build --test --only-dependencies |
| 109 | +
|
| 110 | + - name: Build |
| 111 | + id: build |
| 112 | + run: | |
| 113 | + stack build --test --no-run-tests --no-run-benchmarks |
| 114 | +
|
| 115 | + - name: Test |
| 116 | + run: | |
| 117 | + stack build --test |
0 commit comments