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

Build Mac M1 binary #259

Merged
merged 5 commits into from
Aug 13, 2024
Merged
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
89 changes: 70 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:

env:
ghc: "9.4.8"
cabal: "3.10.3.0"
cabal: "3.8.1.0"

jobs:
validate-code-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: haskell-actions/run-ormolu@v15

linux:
Expand All @@ -26,13 +26,13 @@ jobs:
- name: Install deps
run: apk add alpine-sdk autoconf gcc gmp gmp-dev libffi libffi-dev llvm15 make musl-dev ncurses-dev ncurses-static tree wget zlib-dev zlib-static curl

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install GHCup
run: curl https://downloads.haskell.org/~ghcup/0.1.19.4/x86_64-linux-ghcup-0.1.19.4 -o /usr/local/bin/ghcup && chmod a+x /usr/local/bin/ghcup
run: curl https://downloads.haskell.org/~ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 -o /usr/local/bin/ghcup && chmod a+x /usr/local/bin/ghcup

- name: Cache ghcup
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ghcup
key: ghcup-linux-${{ env.ghc }}
Expand All @@ -50,14 +50,14 @@ jobs:
run: cabal freeze

- name: Cache cabal store
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cabal/store
key: deps-linux-${{ env.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: deps-linux-${{ env.ghc }}-

- name: Cache build artifacts
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dist-newstyle
key: dist-linux-${{ env.ghc }}-${{ github.sha }}
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Strip
run: strip gren

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: gren_linux
path: gren
Expand All @@ -89,10 +89,10 @@ jobs:
needs: validate-code-formatting

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v4
- name: Cache ghcup
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ghcup
key: ghcup-mac-${{ env.ghc }}
Expand All @@ -107,14 +107,14 @@ jobs:
run: cabal freeze

- name: Cache cabal store
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: deps-mac-${{ env.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: deps-mac-${{ env.ghc }}-

- name: Cache build artifacts
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dist-newstyle
key: dist-mac-${{ env.ghc }}-${{ github.sha }}
Expand All @@ -135,11 +135,62 @@ jobs:
- name: Strip
run: strip gren

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: gren_mac
path: gren
retention-days: 14

mac_m1:
runs-on: macos-latest
needs: validate-code-formatting

steps:
- uses: actions/checkout@v4

- id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ env.ghc }}
cabal-version: ${{ env.cabal }}

- name: List exact cabal deps
run: cabal freeze

- name: Cache cabal store
uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: deps-mac-m1-${{ env.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: deps-mac-m1-${{ env.ghc }}-

- name: Cache build artifacts
uses: actions/cache@v4
with:
path: dist-newstyle
key: dist-mac-m1-${{ env.ghc }}-${{ github.sha }}
restore-keys: dist-mac-m1-${{ env.ghc }}-

- name: Configure
run: cabal configure --enable-tests -O2

- name: Build
run: cabal build

- name: Tests
run: cabal test

- name: Move binary
run: cp `cabal list-bin .` ./gren

- name: Strip
run: strip gren

- uses: actions/upload-artifact@v4
with:
name: gren_mac_m1
path: gren
retention-days: 14

windows:
runs-on: windows-latest
Expand All @@ -150,10 +201,10 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- id: setup-haskell
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ env.ghc }}
cabal-version: ${{ env.cabal }}
Expand All @@ -162,14 +213,14 @@ jobs:
run: cabal freeze

- name: Cache cabal store
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: deps-win-${{ env.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: deps-win-${{ env.ghc }}-

- name: Cache build artifacts
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dist-newstyle
key: dist-win-${{ env.ghc }}-${{ github.sha }}
Expand All @@ -190,7 +241,7 @@ jobs:
- name: Strip
run: strip gren

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: gren.exe
path: gren
Expand Down
Loading