Skip to content

Build Linux static binary #33

Build Linux static binary

Build Linux static binary #33

name: Build Linux static binary
on:
workflow_dispatch:
inputs:
ref:
description: "the repository ref to build"
required: true
default: "main"
env:
STACK_VERSION: 2.11.1
jobs:
build:
name: Build static binary
runs-on: ubuntu-latest
container: glcr.b-data.ch/ghc/ghc-musl:9.4.5
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
ref: ${{ github.event.inputs.ref }}
- name: create ~/.local/bin
run: mkdir -p "$HOME/.local/bin"
shell: bash
- name: Add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: install stack
run: |
TAR_BASE_NAME=stack-$STACK_VERSION-linux-x86_64-static
TAR_FILE_NAME=$TAR_BASE_NAME.tar.gz
curl https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/$TAR_FILE_NAME -OL
tar xf $TAR_FILE_NAME
cp $TAR_BASE_NAME/stack /usr/local/bin
- name: Stack permissions bug workaround
run: "chown -R $(id -un):$(id -gn) ~"
# Without this the git command used by githash TemplateHaskell fails with permission error
# https://github.com/anoma/juvix/issues/2294
- name: Git permissions workaround
run: "chown -R $(id -un):$(id -gn) ."
- name: Install clang14
run: apk add --update clang14
- name: Runtime build
run: make runtime LIBTOOL=llvm14-ar
- name: build Juvix
run: stack install --allow-different-user --system-ghc --ghc-options='-split-sections' --flag juvix:static
- run: echo "HOME=$HOME" >> $GITHUB_ENV
shell: bash
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: juvix-linux_x86_64-${{ github.event.inputs.ref }}
path: ${{ env.HOME }}/.local/bin/juvix