Skip to content

Build static Linux arm64 binaries without docker #6928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 5 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,49 +89,6 @@ jobs:
name: rewatch-${{env.artifact_dir_name}}
path: ${{ env.artifact_dir_name }}

# Build statically linked Linux binaries in an Alpine-based Docker container
# See https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml
# for more info.
# The container already comes with all required tools pre-installed
# (see https://github.com/rescript-lang/docker-rescript-ci-build/blob/main/Dockerfile).
# Note: Static ARM64 binaries cannot be built directly on Ubuntu runner because of
# https://github.com/ocaml/opam-repository/issues/26216
build-compiler-linux-arm:
runs-on: buildjet-2vcpu-ubuntu-2204-arm

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build compiler binaries
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01
with:
args: opam exec -- dune build --display quiet --profile static

- name: Build ninja binary
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01
with:
args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap"

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Get artifact dir name
run: node .github/workflows/get_artifact_dir_name.js

- name: Copy exes to platform bin dir
run: |
node ./scripts/copyExes.js -compiler
node ./scripts/copyExes.js -ninja

- name: "Upload artifacts: binaries"
uses: actions/upload-artifact@v4
with:
name: binaries-${{ env.artifact_dir_name }}
path: ${{ env.artifact_dir_name }}

build-compiler:
strategy:
fail-fast: false
Expand All @@ -143,6 +100,9 @@ jobs:
upload_libs: true
# Build the playground compiler on the fastest runner
build_playground: true
- os: buildjet-2vcpu-ubuntu-2204-arm # ARM
ocaml_compiler: ocaml-variants.5.2.0+options,ocaml-option-static
upload_binaries: true
- os: macos-13 # x64
ocaml_compiler: 5.2.0
upload_binaries: true
Expand Down Expand Up @@ -224,6 +184,8 @@ jobs:
uses: ocaml/[email protected]
if: steps.cache-opam-env.outputs.cache-hit != 'true'
with:
opam-repositories: |
default: https://github.com/rescript-lang/opam-repository.git
ocaml-compiler: ${{matrix.ocaml_compiler}}
opam-pin: false

Expand Down Expand Up @@ -422,7 +384,6 @@ jobs:
package:
needs:
- build-compiler
- build-compiler-linux-arm
- build-rewatch

runs-on: ubuntu-latest
Expand Down