|
| 1 | +name: Build |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + workflow_dispatch: |
| 5 | +env: |
| 6 | + OCAML_VERSION: 4.14.2 |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: '[${{ matrix.os }}] Build (Node.JS ${{ matrix.node_version }})' |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + os: [ |
| 13 | + ubuntu-latest, |
| 14 | + macos-latest, |
| 15 | + ] |
| 16 | + node_version: [22, 24] |
| 17 | + fail-fast: false |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + steps: |
| 20 | + - name: Checkout Repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: recursive |
| 24 | + |
| 25 | + - name: Set up Homebrew |
| 26 | + if: runner.os == 'macOS' |
| 27 | + uses: Homebrew/actions/setup-homebrew@f4b81a54c655301a8039231c1ae08f89714fe245 |
| 28 | + |
| 29 | + - name: Install Homebrew dependencies |
| 30 | + if: runner.os == 'macOS' |
| 31 | + env: |
| 32 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 33 | + run: | |
| 34 | + brew install \ |
| 35 | + capnp \ |
| 36 | + binaryen \ |
| 37 | + bzip2 \ |
| 38 | + gnu-sed \ |
| 39 | + libffi \ |
| 40 | + libpq \ |
| 41 | + libsodium \ |
| 42 | + lmdb \ |
| 43 | + pkgconf \ |
| 44 | + postgresql@15 \ |
| 45 | + wasm-pack \ |
| 46 | + wasm-tools \ |
| 47 | + wabt \ |
| 48 | + bash \ |
| 49 | + boost \ |
| 50 | + cmake \ |
| 51 | + gmp \ |
| 52 | + gpatch \ |
| 53 | + jemalloc \ |
| 54 | + libomp |
| 55 | +
|
| 56 | + brew link postgresql@15 |
| 57 | +
|
| 58 | + - name: Install apt dependencies |
| 59 | + if: runner.os == 'Linux' |
| 60 | + run: | |
| 61 | + set -Eeuxo pipefail |
| 62 | + export DEBIAN_FRONTEND=noninteractive |
| 63 | + sudo apt update |
| 64 | + sudo apt install --no-install-recommends --yes \ |
| 65 | + libboost-dev \ |
| 66 | + libboost-program-options-dev \ |
| 67 | + libbz2-dev \ |
| 68 | + libcap-dev \ |
| 69 | + libffi-dev \ |
| 70 | + libgflags-dev \ |
| 71 | + libgmp-dev \ |
| 72 | + libgmp3-dev \ |
| 73 | + libjemalloc-dev \ |
| 74 | + liblmdb-dev \ |
| 75 | + liblmdb0 \ |
| 76 | + libpq-dev \ |
| 77 | + libsodium-dev \ |
| 78 | + libssl-dev \ |
| 79 | + build-essential \ |
| 80 | + ca-certificates \ |
| 81 | + capnproto \ |
| 82 | + cmake \ |
| 83 | + curl \ |
| 84 | + file \ |
| 85 | + git \ |
| 86 | + git-lfs \ |
| 87 | + m4 \ |
| 88 | + pkg-config \ |
| 89 | + rsync \ |
| 90 | + sudo \ |
| 91 | + unzip \ |
| 92 | + binaryen \ |
| 93 | + zlib1g-dev |
| 94 | +
|
| 95 | + - name: Setup Node.JS ${{ matrix.node_version }} |
| 96 | + uses: actions/setup-node@v4 |
| 97 | + with: |
| 98 | + node-version: ${{ matrix.node_version }} |
| 99 | + |
| 100 | + - name: Install Dependencies |
| 101 | + run: npm ci |
| 102 | + |
| 103 | + - name: Set-up OCaml ${{ env.OCAML_VERSION }} |
| 104 | + uses: ocaml/setup-ocaml@v3 |
| 105 | + with: |
| 106 | + ocaml-compiler: ${{ env.OCAML_VERSION }} |
| 107 | + |
| 108 | + - name: Cache opam switch |
| 109 | + id: cache-opam |
| 110 | + uses: actions/cache@v4 |
| 111 | + with: |
| 112 | + path: ./_opam/ |
| 113 | + key: ${{ runner.os }}-${{ env.OCAML_VERSION }}-${{ hashFiles('./src/mina/opam.export') }} |
| 114 | + |
| 115 | + - name: Setup opam switch |
| 116 | + if: steps.cache-opam.outputs.cache-hit != 'true' |
| 117 | + run: | |
| 118 | + set -Eeuxo pipefail |
| 119 | +
|
| 120 | + if [[ "${{ runner.os }}" == "macOS" ]]; then |
| 121 | + export CFLAGS="-I/opt/homebrew/include/" |
| 122 | + export CPPFLAGS="-I/opt/homebrew/include/" |
| 123 | + export C_INCLUDE_PATH="/opt/homebrew/include/" |
| 124 | + export LDFLAGS="-L/opt/homebrew/lib/" |
| 125 | + export PKG_CONFIG_PATH="$(brew --prefix libpq)/lib/pkgconfig:$(brew --prefix libsodium)/lib/pkgconfig" |
| 126 | + fi |
| 127 | +
|
| 128 | + opam repository set-url default https://github.com/ocaml/opam-repository.git\#08d8c16c16dc6b23a5278b06dff0ac6c7a217356 |
| 129 | + opam repository add --yes --all --set-default o1-labs https://github.com/o1-labs/opam-repository.git |
| 130 | + opam pin add --no-action async_ssl https://github.com/o1-labs/async_ssl.git\#v0.14-o1labs |
| 131 | + pushd src/mina |
| 132 | + opam switch import --debug --assume-depexts opam.export |
| 133 | +
|
| 134 | + - name: Setup rust toolchain |
| 135 | + uses: dtolnay/rust-toolchain@master |
| 136 | + with: |
| 137 | + toolchain: nightly-2024-09-05 |
| 138 | + targets: wasm32-unknown-unknown |
| 139 | + components: rust-src |
| 140 | + |
| 141 | + - name: Setup go |
| 142 | + uses: nicholasngai/actions-setup-go@f107e23d356886ae65af3bd7f30d8f6c56801c23 |
| 143 | + with: |
| 144 | + go-version: 1.18.10 |
| 145 | + |
| 146 | + - name: Build bindings |
| 147 | + run: | |
| 148 | + if [[ "${{ runner.os }}" == "macOS" ]]; then |
| 149 | + export RUST_TARGET_FEATURE_OPTIMISATIONS=omit |
| 150 | + export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" |
| 151 | + fi |
| 152 | +
|
| 153 | + eval $(opam env) |
| 154 | + npm run build:bindings-all |
| 155 | +
|
| 156 | + - name: Build |
| 157 | + run: npm run build |
| 158 | + |
| 159 | + - name: Run simple test |
| 160 | + env: |
| 161 | + TEST_TYPE: 'Simple integration tests' |
| 162 | + run: ./run-ci-tests.sh |
| 163 | + timeout-minutes: 60 |
0 commit comments