Skip to content

Build ARM64 MacOS releases #4397

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 9 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
if: matrix.os == 'ubuntu-latest'

- name: cmake (macos)
run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install
run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_OSX_ARCHITECTURES=x86_64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically the explicit architecture isn't needed, since x86_64 is the default (for now....). But making it explicit seems more understandable, and eventually I guess it will no longer be the default? If this is distracting I can take it out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just leave it as the default.

if: matrix.os == 'macos-latest'

- name: cmake (win)
Expand All @@ -82,7 +82,7 @@ jobs:
if: matrix.os == 'windows-latest'

- name: build
run: cmake --build out --config Release
run: cmake --build out --config Release -v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I actually prefer having automated build logs be as verbose as possible. It doesn't really cost anything and anytime you have to debug any issue, usually the first thing you have to do is reproduce it with verbose to see the flags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does -v do when running cmake exactly? We should probably use this flag everywhere or nowhere.


- name: install
run: cmake --install out --config Release
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:
run: mkdir -p out

- name: cmake (macos)
run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install
run: |
cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_OSX_ARCHITECTURES=x86_64
cmake -S . -B out-arm64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out-arm64/install -DCMAKE_OSX_ARCHITECTURES=arm64
if: matrix.os == 'macos-latest'

- name: cmake (win)
Expand All @@ -49,10 +51,14 @@ jobs:
if: matrix.os == 'windows-latest'

- name: build
run: cmake --build out --config Release --target install
run: cmake --build out -v --config Release --target install

- name: build-arm64
run: cmake --build out-arm64 -v --config Release --target install
if: matrix.os == 'macos-latest'

- name: strip
run: find out/install/ -type f -perm -u=x -exec strip -x {} +
run: find out*/install/ -type f -perm -u=x -exec strip -x {} +
if: matrix.os != 'windows-latest'

- name: archive
Expand All @@ -63,20 +69,40 @@ jobs:
PKGNAME="binaryen-$VERSION-x86_64-$OSNAME"
TARBALL=$PKGNAME.tar.gz
SHASUM=$PKGNAME.tar.gz.sha256
rm -rf binaryen-$VERSION
mv out/install binaryen-$VERSION
tar -czf $TARBALL binaryen-$VERSION
# on Windows, MSYS2 will strip the carriage return from CMake output
cmake -E sha256sum $TARBALL > $SHASUM
echo "::set-output name=tarball::$TARBALL"
echo "::set-output name=shasum::$SHASUM"

- name: archive-arm64
id: archive-arm64
run: |
OSNAME=$(echo ${{ matrix.os }} | sed 's/-latest//')
VERSION=$GITHUB_REF_NAME
PKGNAME="binaryen-$VERSION-arm64-$OSNAME"
TARBALL=$PKGNAME.tar.gz
SHASUM=$PKGNAME.tar.gz.sha256
rm -rf binaryen-$VERSION
mv out-arm64/install binaryen-$VERSION
tar -czf $TARBALL binaryen-$VERSION
# on Windows, MSYS2 will strip the carriage return from CMake output
cmake -E sha256sum $TARBALL > $SHASUM
echo "::set-output name=tarball::$TARBALL"
echo "::set-output name=shasum::$SHASUM"
if: matrix.os == 'macos-latest'

- name: upload tarball
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
${{ steps.archive.outputs.tarball }}
${{ steps.archive.outputs.shasum }}
${{ steps.archive-arm64.outputs.tarball }}
${{ steps.archive-arm64.outputs.shasum }}

# Build with gcc 6.3 and run tests on Alpine Linux (inside chroot).
# Note: Alpine uses musl libc.
Expand Down