From 2ae0156794077c06da4dd7444518c920358ab899 Mon Sep 17 00:00:00 2001 From: Takahiro Ueda Date: Fri, 6 Sep 2024 20:11:18 +0900 Subject: [PATCH 1/2] ci: migrate from macOS 11 to 12 The macOS 11 runner image has been removed from GitHub Actions. https://github.blog/changelog/2024-05-20-actions-upcoming-changes-to-github-hosted-macos-runners/ --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b74769fe..17d16d6b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -58,8 +58,8 @@ jobs: # platforms available. - {os: ubuntu-20.04, shell: bash, bin: form} - {os: ubuntu-20.04, shell: bash, bin: tform} - - {os: macos-11, shell: bash, bin: form} - - {os: macos-11, shell: bash, bin: tform} + - {os: macos-12, shell: bash, bin: form} + - {os: macos-12, shell: bash, bin: tform} # NOTE: Windows native executables have too many problems. # We include them in artifacts but not in releases. # Unfortunately, "allow-failure" is not available on GitHub Actions From ffc1d3ffd655d205dc21513a71763a1e6d79b75a Mon Sep 17 00:00:00 2001 From: Takahiro Ueda Date: Sat, 7 Sep 2024 14:56:46 +0900 Subject: [PATCH 2/2] ci: deploy arm64-osx binary Use the fact that the macos-14 image runs on M1 (arm64) macOS runners. https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/ --- .github/workflows/deploy.yml | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 17d16d6b..875499b9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -60,6 +60,9 @@ jobs: - {os: ubuntu-20.04, shell: bash, bin: tform} - {os: macos-12, shell: bash, bin: form} - {os: macos-12, shell: bash, bin: tform} + # The macos-14 runner image is based on the arm64 architecture. + - {os: macos-14, shell: bash, bin: form} + - {os: macos-14, shell: bash, bin: tform} # NOTE: Windows native executables have too many problems. # We include them in artifacts but not in releases. # Unfortunately, "allow-failure" is not available on GitHub Actions @@ -110,10 +113,20 @@ jobs: # -l:libgmp.a to make partial static links possible. # As a workaround, we make a library directory with libgmp.a # but without libgmp.dylib so that the linker has to link libgmp.a. + # Note that the Homebrew installation path for Apple Silicon (arm64) + # differs from the one on macOS Intel (x86-64). + mkdir static-lib if [ "$RUNNER_OS" == "macOS" ]; then - mkdir static-lib - ln -s /usr/local/opt/gmp/lib/libgmp.a static-lib/libgmp.a - ln -s /usr/local/opt/mpfr/lib/libmpfr.a static-lib/libmpfr.a + if [ "$RUNNER_ARCH" == "ARM64" ]; then + ln -s /opt/homebrew/opt/gmp/lib/libgmp.a static-lib/libgmp.a + ln -s /opt/homebrew/opt/mpfr/lib/libmpfr.a static-lib/libmpfr.a + # The GMP and MPFR include directories, not located in the usual places, + # must be explicitly appended to the include paths. + export CPATH="/opt/homebrew/opt/gmp/include:/opt/homebrew/opt/mpfr/include:${CPATH:-}" + else + ln -s /usr/local/opt/gmp/lib/libgmp.a static-lib/libgmp.a + ln -s /usr/local/opt/mpfr/lib/libmpfr.a static-lib/libmpfr.a + fi export LIBRARY_PATH="$(pwd)/static-lib:${LIBRARY_PATH:-}" opts="$opts --disable-static-link" fi @@ -127,7 +140,10 @@ jobs: continue-on-error: ${{ runner.os == 'Windows' }} run: | if [ "$RUNNER_OS" == "macOS" ]; then - export LIBRARY_PATH="$(pwd)/static-lib:${LIBRARY_PATH:-}" + if [ "$RUNNER_ARCH" == "ARM64" ]; then + export CPATH="/opt/homebrew/opt/gmp/include:/opt/homebrew/opt/mpfr/include:${CPATH:-}" + fi + export LIBRARY_PATH="$(pwd)/static-lib:${LIBRARY_PATH:-}" fi make -j 4 @@ -324,10 +340,18 @@ jobs: tar -c $pkgname/* | gzip -c -9 >dist/$pkgname.tar.gz rm -rf $pkgname fi - if ls artifacts/*-macos-*/*form >/dev/null 2>&1; then + if ls artifacts/*-macos-12/*form >/dev/null 2>&1; then pkgname=$distname-x86_64-osx mkdir $pkgname - mv artifacts/*-macos-*/*form $pkgname + mv artifacts/*-macos-12/*form $pkgname + chmod +x $pkgname/*form + tar -c $pkgname/* | gzip -c -9 >dist/$pkgname.tar.gz + rm -rf $pkgname + fi + if ls artifacts/*-macos-14/*form >/dev/null 2>&1; then + pkgname=$distname-arm64-osx + mkdir $pkgname + mv artifacts/*-macos-14/*form $pkgname chmod +x $pkgname/*form tar -c $pkgname/* | gzip -c -9 >dist/$pkgname.tar.gz rm -rf $pkgname