mirror of
https://github.com/anoma/juvix.git
synced 2024-12-02 10:47:32 +03:00
Use the justfile for CI builds (#2730)
This PR changes the CI build to use the justfile instead of the Makefile to run builds and tests. CI builds now take advantage of parallel module builds from https://github.com/anoma/juvix/pull/2729. In order support this the runtime build target in the justfile now supports `runtimeCcArg` and `runtimeLibtoolArg` so that the `CC` and `LIBTOOL` Makefile argument can be set. This is required for the macOS build. In addition this PR upgrades the stack setup step action. Previously the stack build flags included `--fast` which meant the whole project was rebuilt in the `test` step, this has also been fixed. Overall this speeds up the CI: * Linux now takes 30mins (from 40mins) * macOS now takes 60mins (from 80mins)
This commit is contained in:
parent
2ec8a4343a
commit
b0fb240219
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@ -27,6 +27,8 @@ env:
|
||||
VAMPIRREPO: anoma/vamp-ir
|
||||
VAMPIRVERSION: v0.1.3
|
||||
CAIRO_VM_VERSION: ae06ba04f3b6864546b6baeeebf1b0735ddccb5d
|
||||
JUST_ARGS: enableOptimized=yes runtimeCcArg=$CC runtimeLibtoolArg=$LIBTOOL
|
||||
STACK_BUILD_ARGS: --pedantic -j4 --ghc-options=-j
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
@ -58,6 +60,8 @@ jobs:
|
||||
build-and-test-linux:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: extractions/setup-just@v2
|
||||
|
||||
- name: Checkout our repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
@ -158,7 +162,7 @@ jobs:
|
||||
- name: Make runtime
|
||||
run: |
|
||||
cd main
|
||||
make runtime
|
||||
just ${{ env.JUST_ARGS }} build runtime
|
||||
|
||||
# We use the options:
|
||||
# - -fhide-source-paths
|
||||
@ -176,9 +180,10 @@ jobs:
|
||||
|
||||
- name: Stack setup
|
||||
id: stack
|
||||
uses: freckle/stack-action@v4
|
||||
uses: freckle/stack-action@v5
|
||||
with:
|
||||
working-directory: main
|
||||
stack-build-arguments: ${{ env.STACK_BUILD_ARGS }}
|
||||
test: false
|
||||
|
||||
- name: Install and test Juvix
|
||||
@ -186,8 +191,8 @@ jobs:
|
||||
if: ${{ success() }}
|
||||
run: |
|
||||
cd main
|
||||
make install
|
||||
make test
|
||||
just ${{ env.JUST_ARGS }} install
|
||||
just ${{ env.JUST_ARGS }} test
|
||||
|
||||
- name: Typecheck and format Juvix examples
|
||||
if: ${{ success() }}
|
||||
@ -225,6 +230,8 @@ jobs:
|
||||
build-and-test-macos:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: extractions/setup-just@v2
|
||||
|
||||
- name: Checkout our repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
@ -354,7 +361,7 @@ jobs:
|
||||
- name: Make runtime
|
||||
run: |
|
||||
cd main
|
||||
make CC=$CC LIBTOOL=$LIBTOOL runtime
|
||||
just ${{ env.JUST_ARGS }} build runtime
|
||||
|
||||
# We use the options:
|
||||
# - -fhide-source-paths
|
||||
@ -372,9 +379,10 @@ jobs:
|
||||
|
||||
- name: Stack setup
|
||||
id: stack
|
||||
uses: freckle/stack-action@v4
|
||||
uses: freckle/stack-action@v5
|
||||
with:
|
||||
working-directory: main
|
||||
stack-build-arguments: ${{ env.STACK_BUILD_ARGS }}
|
||||
test: false
|
||||
|
||||
- name: Add homebrew clang to the PATH (macOS)
|
||||
@ -399,8 +407,8 @@ jobs:
|
||||
if: ${{ success() }}
|
||||
run: |
|
||||
cd main
|
||||
make CC=$CC LIBTOOL=$LIBTOOL install
|
||||
make CC=$CC LIBTOOL=$LIBTOOL test
|
||||
just ${{ env.JUST_ARGS }} install
|
||||
just ${{ env.JUST_ARGS }} test
|
||||
|
||||
- name: Typecheck and format Juvix examples
|
||||
if: ${{ success() }}
|
||||
|
17
justfile
17
justfile
@ -22,6 +22,17 @@ stack := "stack"
|
||||
# the command used to run ormolu
|
||||
ormolu := "ormolu"
|
||||
|
||||
# The CC argument to the runtime Makefile
|
||||
runtimeCcArg := ''
|
||||
|
||||
# The LIBTOOL argument to the runtime Makefile
|
||||
runtimeLibtoolArg := ''
|
||||
|
||||
# The flags used in the runtime make commands
|
||||
runtimeCcFlag := if runtimeCcArg == '' { '' } else { "CC=" + runtimeCcArg }
|
||||
runtimeLibtoolFlag := if runtimeLibtoolArg == '' { '' } else { "LIBTOOL=" + runtimeLibtoolArg }
|
||||
runtimeArgs := trim(runtimeCcFlag + ' ' + runtimeLibtoolFlag)
|
||||
|
||||
# flags used in the stack command
|
||||
stackOptFlag := if enableOptimized == '' { '--fast' } else { '' }
|
||||
# The ghc `-j` flag defaults to number of cpus when no argument is passed
|
||||
@ -93,7 +104,7 @@ run-profile +cmd:
|
||||
|
||||
# Build the juvix runtime
|
||||
_buildRuntime:
|
||||
cd runtime && make -j 4 -s
|
||||
cd runtime && make {{ runtimeArgs }} -j 4 -s
|
||||
|
||||
# Build the project. `build runtime` builds only the runtime.
|
||||
[no-exit-message]
|
||||
@ -104,10 +115,10 @@ build *opts:
|
||||
|
||||
case $opts in
|
||||
runtime)
|
||||
just _buildRuntime
|
||||
just runtimeArgs="{{ runtimeArgs }}" _buildRuntime
|
||||
;;
|
||||
*)
|
||||
just _buildRuntime
|
||||
just runtimeArgs="{{ runtimeArgs }}" _buildRuntime
|
||||
set -x
|
||||
{{ stack }} build {{ stackArgs }}
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user