From af39846bdc728decbcc6a7ab2792068011e67091 Mon Sep 17 00:00:00 2001 From: Apprentice-Alchemist <53486764+Apprentice-Alchemist@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:09:50 +0100 Subject: [PATCH] ARM Mac CI --- .github/workflows/main.yml | 101 +++++++++++++++++++++++- extra/github-actions/build-mac.yml | 2 +- extra/github-actions/workflows/main.yml | 21 +++++ 3 files changed, 122 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce7248347b1..fbd48c6447b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -673,7 +673,106 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: macBinaries + name: ${{ env.PLATFORM }}Binaries + path: out + + + mac-arm-build: + runs-on: macos-14 + env: + PLATFORM: mac-arm + OPAMYES: 1 + MACOSX_DEPLOYMENT_TARGET: 11 + steps: + - uses: actions/checkout@main + with: + submodules: recursive + + - name: Cache opam + id: cache-opam + uses: actions/cache@v3.0.11 + with: + path: ~/.opam/ + key: ${{ runner.os }}-${{ hashFiles('./haxe.opam', './libs/') }} + + - name: Install Neko from S3 + run: | + set -ex + + curl -sSL https://build.haxe.org/builds/neko/$PLATFORM/neko_latest.tar.gz -o $RUNNER_TEMP/neko_latest.tar.gz + tar -xf $RUNNER_TEMP/neko_latest.tar.gz -C $RUNNER_TEMP + NEKOPATH=`echo $RUNNER_TEMP/neko-*-*` + sudo mkdir -p /usr/local/bin + sudo mkdir -p /usr/local/lib/neko + sudo ln -s $NEKOPATH/{neko,nekoc,nekoml,nekotools} /usr/local/bin/ + sudo ln -s $NEKOPATH/libneko.* /usr/local/lib/ + sudo ln -s $NEKOPATH/*.ndll /usr/local/lib/neko/ + echo "NEKOPATH=$NEKOPATH" >> $GITHUB_ENV + + - name: Print Neko version + run: neko -version 2>&1 + + - name: Install dependencies + env: + # For compatibility with macOS 10.13 + ZLIB_VERSION: 1.3.1 + MBEDTLS_VERSION: 2.28.5 + PCRE2_VERSION: 10.42 + run: | + set -ex + brew update + brew bundle --file=tests/Brewfile --no-upgrade + cpanm IPC::System::Simple + cpanm String::ShellQuote + curl -L https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz | tar xz + cd zlib-$ZLIB_VERSION + ./configure + make && make install + cd .. + curl -L https://github.com/ARMmbed/mbedtls/archive/v$MBEDTLS_VERSION.tar.gz | tar xz + cd mbedtls-$MBEDTLS_VERSION + make && make install + cd .. + curl -L https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz | tar xz + cd pcre2-$PCRE2_VERSION + ./configure --enable-unicode --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32 --enable-unicode-properties --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-jit + make && make install + cd .. + + - name: Install OCaml libraries + if: steps.cache-opam.outputs.cache-hit != 'true' + run: | + set -ex + opam init # --disable-sandboxing + opam update + opam switch create 4.08.1 + eval $(opam env) + opam env + opam pin add ctypes 0.17.1 --yes + opam pin add haxe . --no-action + opam install haxe --deps-only --assume-depexts + opam list + ocamlopt -v + + - name: Set ADD_REVISION=1 for non-release + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: echo "ADD_REVISION=1" >> $GITHUB_ENV + + - name: Build Haxe + run: | + set -ex + eval $(opam env) + opam config exec -- make -s -j`sysctl -n hw.ncpu` STATICLINK=1 "LIB_PARAMS=/usr/local/lib/libz.a /usr/local/lib/libpcre2-8.a /usr/local/lib/libmbedtls.a /usr/local/lib/libmbedcrypto.a /usr/local/lib/libmbedx509.a -cclib '-framework Security -framework CoreFoundation'" haxe + opam config exec -- make -s haxelib + make -s package_unix package_installer_mac + ls -l out + otool -L ./haxe + otool -L ./haxelib + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ env.PLATFORM }}Binaries path: out diff --git a/extra/github-actions/build-mac.yml b/extra/github-actions/build-mac.yml index 518912aff7a..99c33610f98 100644 --- a/extra/github-actions/build-mac.yml +++ b/extra/github-actions/build-mac.yml @@ -58,5 +58,5 @@ - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: macBinaries + name: ${{ env.PLATFORM }}Binaries path: out diff --git a/extra/github-actions/workflows/main.yml b/extra/github-actions/workflows/main.yml index 4b2825ccb37..b2a1edc3fbe 100644 --- a/extra/github-actions/workflows/main.yml +++ b/extra/github-actions/workflows/main.yml @@ -349,6 +349,27 @@ jobs: @import install-neko-unix.yml @import build-mac.yml + mac-arm-build: + runs-on: macos-14 + env: + PLATFORM: mac-arm + OPAMYES: 1 + MACOSX_DEPLOYMENT_TARGET: 11 + steps: + - uses: actions/checkout@main + with: + submodules: recursive + + - name: Cache opam + id: cache-opam + uses: actions/cache@v3.0.11 + with: + path: ~/.opam/ + key: ${{ runner.os }}-${{ hashFiles('./haxe.opam', './libs/') }} + + @import install-neko-unix.yml + @import build-mac.yml + windows64-test: needs: windows64-build runs-on: windows-latest