Skip to content

Build Linux static binary #47

Build Linux static binary

Build Linux static binary #47

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: quay.io/benz0li/ghc-musl:9.8.2
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 cargo
run: apk add --update cargo
- name: Install clang
run: apk add --update clang
- name: Install llvm
run: apk add --update llvm
- name: Runtime build
run: make runtime LIBTOOL=llvm-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