Skip to content

Commit

Permalink
Merge mac CI configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinheghan committed Oct 12, 2024
1 parent 4e0c13a commit 00adfb6
Showing 1 changed file with 8 additions and 62 deletions.
70 changes: 8 additions & 62 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,65 +101,11 @@ jobs:
retention-days: 14

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

steps:
- uses: actions/checkout@v4

- name: Cache ghcup
uses: actions/cache@v4
with:
path: ~/.ghcup
key: ghcup-mac-${{ env.ghc }}

- 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-${{ env.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: deps-mac-${{ env.ghc }}-

- name: Cache build artifacts
uses: actions/cache@v4
with:
path: dist-newstyle
key: dist-mac-${{ env.ghc }}-${{ github.sha }}
restore-keys: dist-mac-${{ 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
path: gren
retention-days: 14

mac_m1:
runs-on: macos-latest
needs: validate-code-formatting
strategy:
matrix:
os: [macos-13, macos-14]

steps:
- uses: actions/checkout@v4
Expand All @@ -177,21 +123,21 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cabal/store
key: deps-mac-m1-${{ env.ghc }}-${{ hashFiles('cabal.project.freeze') }}
key: deps-${{ matrix.os }}-${{ hashFiles('devbox.lock', '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 }}-
key: dist-${{ matrix.os }}-${{ github.sha }}
restore-keys: dist-${{ matrix.os }}-

- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules
key: npm-mac-m1-${{ hashFiles('devbox.lock', 'package-lock.json') }}
key: npm-${{ matrix.os }}-${{ hashFiles('devbox.lock', 'package-lock.json') }}

- name: Install npm dependencies
run: devbox run -- npm install
Expand All @@ -213,7 +159,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: gren_mac_m1
name: gren_${{ matrix.os }}
path: gren
retention-days: 14

Expand Down

0 comments on commit 00adfb6

Please sign in to comment.