Skip to content

Commit

Permalink
GitHub Actions: build x86_64 and aarch64 binaries for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
msakai committed Nov 10, 2024
1 parent 9ded194 commit a55ac07
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
33 changes: 28 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,19 @@ jobs:
coveralls: false
release: true
- ghc: '9.6.6'
os: macos-13 # Intel Mac
os: macos-latest
stack_yaml: 'stack-ghc-9.6.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018'
platform: macos
platform: macos-aarch64
coveralls: false
release: true
- ghc: '9.6.6'
os: macos-latest
stack_yaml: 'stack-ghc-9.6.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018'
platform: macos-x86_64
coveralls: false
release: true

Expand Down Expand Up @@ -101,16 +109,23 @@ jobs:
with:
submodules: true

- name: Write arch to stack.yaml (macos-x86_64)
if: matrix.platform == 'macos-x86_64'
run: |
echo "arch: x86_64" >> ${STACK_YAML}
- uses: haskell-actions/setup@v2
id: setup-haskell
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
stack-no-global: ${{ (matrix.platform == 'macos-x86_64' || matrix.platform == 'win32') && 'true' || '' }}
cabal-update: false

- name: Setup stack
- name: Setup stack to use system GHC
if: matrix.platform != 'macos-x86_64' && matrix.platform != 'win32'
run: stack config set system-ghc --global true

#- name: Fix ld path (Windows)
Expand Down Expand Up @@ -166,7 +181,11 @@ jobs:
- name: Test IPASIR DLL using genipaessentials
shell: bash
run: |
stack exec -- g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials
if [[ ${{ matrix.platform }} = "macos-x86_64" ]]; then
stack exec -- arch -x86_64 g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials
else
stack exec -- g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials
fi
if [[ ${{ runner.os }} = "macOS" ]]; then
install_name_tool -add_rpath `stack path --local-install-root`/lib genipaessentials
elif [[ ${{ runner.os }} = "Windows" ]]; then
Expand Down Expand Up @@ -220,7 +239,11 @@ jobs:
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-macos
name: binary-packages-macos-aarch64
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-macos-x86_64
path: binary-packages
- uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion misc/build_artifacts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ main = sh $ do
case Info.os of
"mingw32" -> (if Info.arch == "x86_64" then "win64" else "win32", Just "exe", archive7z)
"linux" -> ("linux-" ++ Info.arch, Nothing, archiveTarXz)
"darwin" -> ("macos", Nothing, archiveTarXz)
"darwin" -> ("macos-" ++ Info.arch, Nothing, archiveTarXz)
_ -> error ("unknown os: " ++ Info.os)
exe_files =
[ "toyconvert"
Expand Down

0 comments on commit a55ac07

Please sign in to comment.