Merge pull request #166 from gren-lang/enable-static-linking

Configure static builds.
This commit is contained in:
Robin Heggelund Hansen 2022-12-15 08:28:52 +01:00 committed by GitHub
commit 42690bbaba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 188 additions and 110 deletions

188
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,188 @@
name: Build
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
env:
ghc: "9.4.2"
cabal: "3.8.1.0"
jobs:
validate-code-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mrkkrp/ormolu-action@v8
linux:
runs-on: ubuntu-latest
container: alpine:3.17
needs: validate-code-formatting
steps:
- 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
- name: Install GHCup
run: curl https://downloads.haskell.org/~ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 -o /usr/local/bin/ghcup && chmod a+x /usr/local/bin/ghcup
- name: Cache ghcup
uses: actions/cache@v3
with:
path: ~/.ghcup
key: ghcup-linux-${{ env.ghc }}
- name: Install Haskell
run: ghcup install ghc ${{ env.ghc }} --set && ghcup install cabal ${{ env.cabal }} --set
- name: Update PATH
run: echo "$HOME/.ghcup/bin" >> $GITHUB_PATH
- name: Cabal update
run: cabal update
- name: Cache cabal store
uses: actions/cache@v3
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
with:
path: dist-newstyle
key: dist-linux-${{ env.ghc }}-${{ github.sha }}
restore-keys: dist-linux-${{ env.ghc }}-
- name: Configure
run: cabal configure --enable-tests --enable-executable-static --ghc-option=-split-sections -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@v3
with:
name: gren_linux
path: gren
retention-days: 14
mac:
runs-on: macos-latest
needs: validate-code-formatting
steps:
- uses: actions/checkout@v3
- name: Cache ghcup
uses: actions/cache@v3
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: Cache cabal store
uses: actions/cache@v3
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
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@v3
with:
name: gren_mac
path: gren
retention-days: 14
windows:
runs-on: windows-latest
needs: validate-code-formatting
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- id: setup-haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ env.ghc }}
cabal-version: ${{ env.cabal }}
- name: Cache cabal store
uses: actions/cache@v3
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
with:
path: dist-newstyle
key: dist-win-${{ env.ghc }}-${{ github.sha }}
restore-keys: dist-win-${{ 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@v3
with:
name: gren.exe
path: gren
retention-days: 14

View File

@ -1,61 +0,0 @@
name: Release
on:
push:
branches: [ 'main' ]
defaults:
run:
shell: bash
jobs:
build:
strategy:
fail-fast: false
matrix:
ghc: ['9.4.2']
cabal: ['3.8.1.0']
os:
- ubuntu-20.04
- macOS-latest
- windows-latest
name: release-${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Configure environment
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: deps-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: deps-${{ runner.os }}-${{ matrix.ghc }}-
- name: Cache
uses: actions/cache@v2
with:
path: dist-newstyle
key: dist-${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
restore-keys: dist-${{ runner.os }}-${{ matrix.ghc }}-
- name: Build
run: cabal install --install-method=copy --installdir=dist/
- uses: actions/upload-artifact@v3
with:
name: gren-${{ runner.os }}
path: dist/
retention-days: 30

View File

@ -1,49 +0,0 @@
name: Verify build
on:
pull_request:
branches: [ main ]
defaults:
run:
shell: bash
jobs:
build:
name: verify
runs-on: ubuntu-latest
strategy:
matrix:
ghc: ["9.4.2"]
cabal: ["3.8.1.0"]
steps:
- uses: actions/checkout@v3
- uses: mrkkrp/ormolu-action@v8
- uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: deps-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: deps-${{ runner.os }}-${{ matrix.ghc }}-
- name: Cache
uses: actions/cache@v2
with:
path: dist-newstyle
key: dist-${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
restore-keys: dist-${{ runner.os }}-${{ matrix.ghc }}-
- name: Build
run: cabal build --enable-tests
- name: Tests
run: cabal test