|
| 1 | +on: |
| 2 | + push: |
| 3 | + workflow_dispatch: |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + # TODO: should we run the tests, or can we assume that a v* tag ought to |
| 8 | + # get published? |
| 9 | + name: build |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + node: [20, 22] |
| 13 | + os: |
| 14 | + # macos-14 is arm64 (m1) |
| 15 | + - name: darwin |
| 16 | + host: macos-14 |
| 17 | + |
| 18 | + # macos-13 is x86 |
| 19 | + - name: mac-x64 |
| 20 | + host: macos-13 |
| 21 | + |
| 22 | + # ubuntu-20.04 is x86. Still no arm linux runners yet |
| 23 | + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories |
| 24 | + - name: linux |
| 25 | + host: ubuntu-20.04 |
| 26 | + |
| 27 | + - name: linux-x64 |
| 28 | + host: ubnutu-22.04-arm |
| 29 | + env: |
| 30 | + CC: clang |
| 31 | + CXX: clang++ |
| 32 | + npm_config_clang: 1 |
| 33 | + GYP_DEFINES: use_obsolete_asm=true |
| 34 | + runs-on: ${{ matrix.os.host }} |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + submodules: true |
| 39 | + - uses: actions/setup-node@v4 |
| 40 | + with: |
| 41 | + node-version: ${{ matrix.node }} |
| 42 | + check-latest: true |
| 43 | + - name: Prebuildify |
| 44 | + run: | |
| 45 | + [[ $(uname -o) == *Linux ]] && \ |
| 46 | + sudo apt-get update && \ |
| 47 | + sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3 |
| 48 | + npm ci |
| 49 | + npx prebuildify --napi --strip --tag-libc -t "$(node --version | tr -d 'v')" |
| 50 | + - uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: prebuild-${{ runner.os }}-${{ runner.arch }} |
| 53 | + path: ./prebuilds |
| 54 | + retention-days: 14 |
| 55 | + |
| 56 | + cross-compile: |
| 57 | + name: "cross compile linux/arm" |
| 58 | + runs-on: ubuntu-22.04-arm |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + - uses: docker/setup-qemu-action@v3 |
| 62 | + # todo: move this to an x64 build box |
| 63 | + # - name: build linux musl x64 |
| 64 | + # run: | |
| 65 | + # docker build --platform=linux/amd64 --tag nodegit-linux-musl-amd64 -f scripts/Dockerfile.alpine . |
| 66 | + # docker create --platform=linux/amd64 --name nodegit-linux-musl-amd64 nodegit-linux-musl-amd64 |
| 67 | + # docker cp "nodegit-linux-musl-amd64:/app/prebuilds" . |
| 68 | + - name: build linux musl arm |
| 69 | + run: | |
| 70 | + docker build --platform=linux/arm64 --tag nodegit-linux-musl-arm64 -f scripts/Dockerfile.alpine . |
| 71 | + docker create --platform=linux/arm64 --name nodegit-linux-musl-arm64 nodegit-linux-musl-arm64 |
| 72 | + docker cp "nodegit-linux-musl-arm64:/app/prebuilds" . |
| 73 | + - name: "list the generated files" |
| 74 | + run: find prebuilds |
| 75 | + - uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: prebuild-linux-arm64 |
| 78 | + path: ./prebuilds |
| 79 | + retention-days: 14 |
0 commit comments