Skip to content

Commit

Permalink
Natively assemble eqwalizer instead of using emulation on ARM
Browse files Browse the repository at this point in the history
Summary:
The emulation step takes up to 1h 30m, which represents 86% of the overall CI process. Emulation is not necessary any longer, since [GitHub released arm hosts publicly](https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/?fbclid=IwZXh0bgNhZW0CMTEAAR2BwUNr26OpvrR7tpbEhWhaOFoozPymryx3Fo1WOaCPnF6rtMXAJN0gYAc_aem_28GH1eyotDOguj02sAVKLQ).

This reduces **CI time from 1h:40m to 20m (80% improvement)**, which should also significantly [bring down the CI costs](https://www.internalfb.com/intern/opensource/github/repo/675902051252178/budget/).

Reviewed By: alanz

Differential Revision: D69588366

fbshipit-source-id: 2d73403c882bb2c07c318e09158d1f0d8e610c66
  • Loading branch information
robertoaloi authored and facebook-github-bot committed Feb 13, 2025
1 parent 5cd4fee commit 44be05f
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
ci:
strategy:
matrix:
platform-arch: [ubuntu-20.04-x64, ubuntu-20.04-arm, macos-13-x64, macos-latest-arm]
platform-arch: [ubuntu-20.04-x64, ubuntu-22.04-arm, macos-13-x64, macos-latest-arm]
otp-version: [25.3, 26.2, 27.1]
include:
- otp-version: 25.3
Expand All @@ -28,8 +28,8 @@ jobs:
os: linux
target: x86_64-unknown-linux-gnu
vscode-target: linux-x64
- platform-arch: ubuntu-20.04-arm
platform: ubuntu-20.04
- platform-arch: ubuntu-22.04-arm
platform: ubuntu-22.04-arm
os: linux
target: aarch64-unknown-linux-gnu
vscode-target: linux-arm64
Expand All @@ -54,22 +54,21 @@ jobs:
path: eqwalizer
ref: main
- name: Set up GraalVM
if: matrix.platform-arch != 'ubuntu-20.04-arm'
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up SBT
uses: olafurpg/setup-scala@v11
uses: olafurpg/setup-scala@v14
with:
java-version: '17'
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Set up cross-compiler
if: matrix.platform-arch == 'ubuntu-20.04-arm'
if: matrix.platform-arch == 'ubuntu-22.04-arm'
run: |
sudo apt-get update
sudo apt-get install -y crossbuild-essential-arm64
Expand Down Expand Up @@ -100,37 +99,11 @@ jobs:
working-directory: eqwalizer/eqwalizer
run: "sbt assembly"
- name: Assemble eqwalizer binary
if: matrix.platform-arch != 'ubuntu-20.04-arm'
working-directory: eqwalizer/eqwalizer
run: 'native-image -H:IncludeResources=application.conf --no-server --no-fallback -jar target/scala-2.13/eqwalizer.jar eqwalizer'
- name: Assemble eqwalizer binary (qemu)
if: matrix.platform-arch == 'ubuntu-20.04-arm'
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu20.04
dockerRunArgs: |
--volume "${PWD}/eqwalizer/eqwalizer:/eqwalizer"
install: |
apt-get -q update
apt-get -q install -y curl gcc zlib1g-dev
GRAALVM_URL=https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-aarch64_bin.tar.gz
GRAALVM_SHA256=$(curl -s "${GRAALVM_URL}.sha256")
curl --output graalvm.tar.gz "${GRAALVM_URL}"
echo "$GRAALVM_SHA256 graalvm.tar.gz" | sha256sum -c
mkdir /opt/graalvm
tar -xzf graalvm.tar.gz -C /opt/graalvm --strip-components=1
run: |
/opt/graalvm/bin/native-image \
-H:IncludeResources=application.conf \
-H:+ReportExceptionStackTraces \
--no-server \
--no-fallback \
-jar /eqwalizer/target/scala-2.13/eqwalizer.jar \
/eqwalizer/eqwalizer
- name: Test elp
# Do not run the tests in case of cross-compilation
if: (matrix.platform-arch != 'ubuntu-20.04-arm') && (matrix.platform-arch != 'macos-latest-arm')
if: matrix.platform-arch != 'macos-latest-arm'
run: 'cargo test --no-default-features --workspace --target ${{ matrix.target }}'
- name: Build elp
run: 'cargo build --release --target ${{ matrix.target }} --config target.aarch64-unknown-linux-gnu.linker=\"aarch64-linux-gnu-gcc\"'
Expand Down

0 comments on commit 44be05f

Please sign in to comment.