Skip to content
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

GitHub Actions: build x86_64 and aarch64 binaries for macos #116

Merged
merged 1 commit into from
Nov 10, 2024
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
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 @@
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 Expand Up @@ -58,12 +58,12 @@
when b $ rmtree pkg

mktree (pkg </> "bin")
let binDir = fromText (lineToText local_install_root) </> "bin"

Check warning on line 61 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.8.2, ubuntu-latest, stack-ghc-9.8.yaml, --flag toysolver:BuildToyFMF --flag toysolver:Bu...

In the use of ‘fromText’

Check warning on line 61 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.4.8, ubuntu-latest, stack-ghc-9.4.yaml, --haddock --no-haddock-deps, --flag toysolver:Bu...

In the use of ‘fromText’

Check warning on line 61 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.6.6, ubuntu-latest, stack-ghc-9.6.yaml, --haddock --no-haddock-deps, --flag toysolver:Bu...

In the use of ‘fromText’

Check warning on line 61 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.6.6, macos-latest, stack-ghc-9.6.yaml, --flag toysolver:BuildToyFMF --flag toysolver:Bui...

In the use of ‘fromText’

Check warning on line 61 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.6.6, macos-latest, stack-ghc-9.6.yaml, --flag toysolver:BuildToyFMF --flag toysolver:Bui...

In the use of ‘fromText’
forM exe_files $ \name -> do
cp (binDir </> addExeSuffix name) (pkg </> "bin" </> addExeSuffix name)

mktree (pkg </> "lib")
let libDir = fromText (lineToText local_install_root) </> "lib"

Check warning on line 66 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.8.2, ubuntu-latest, stack-ghc-9.8.yaml, --flag toysolver:BuildToyFMF --flag toysolver:Bu...

In the use of ‘fromText’

Check warning on line 66 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.4.8, ubuntu-latest, stack-ghc-9.4.yaml, --haddock --no-haddock-deps, --flag toysolver:Bu...

In the use of ‘fromText’

Check warning on line 66 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.6.6, ubuntu-latest, stack-ghc-9.6.yaml, --haddock --no-haddock-deps, --flag toysolver:Bu...

In the use of ‘fromText’

Check warning on line 66 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.6.6, macos-latest, stack-ghc-9.6.yaml, --flag toysolver:BuildToyFMF --flag toysolver:Bui...

In the use of ‘fromText’

Check warning on line 66 in misc/build_artifacts.hs

View workflow job for this annotation

GitHub Actions / build (9.6.6, macos-latest, stack-ghc-9.6.yaml, --flag toysolver:BuildToyFMF --flag toysolver:Bui...

In the use of ‘fromText’
when (Info.os == "mingw32") $ do
cp (libDir </> "toysat-ipasir.dll") (pkg </> "bin" </> "toysat-ipasir.dll")
proc "stack"
Expand Down
Loading