1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-03 09:41:10 +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:
Paul Cadman 2024-04-18 11:52:37 +01:00 committed by GitHub
parent 2ec8a4343a
commit b0fb240219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 11 deletions

View File

@ -27,6 +27,8 @@ env:
VAMPIRREPO: anoma/vamp-ir VAMPIRREPO: anoma/vamp-ir
VAMPIRVERSION: v0.1.3 VAMPIRVERSION: v0.1.3
CAIRO_VM_VERSION: ae06ba04f3b6864546b6baeeebf1b0735ddccb5d CAIRO_VM_VERSION: ae06ba04f3b6864546b6baeeebf1b0735ddccb5d
JUST_ARGS: enableOptimized=yes runtimeCcArg=$CC runtimeLibtoolArg=$LIBTOOL
STACK_BUILD_ARGS: --pedantic -j4 --ghc-options=-j
jobs: jobs:
pre-commit: pre-commit:
@ -58,6 +60,8 @@ jobs:
build-and-test-linux: build-and-test-linux:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: extractions/setup-just@v2
- name: Checkout our repository - name: Checkout our repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -158,7 +162,7 @@ jobs:
- name: Make runtime - name: Make runtime
run: | run: |
cd main cd main
make runtime just ${{ env.JUST_ARGS }} build runtime
# We use the options: # We use the options:
# - -fhide-source-paths # - -fhide-source-paths
@ -176,9 +180,10 @@ jobs:
- name: Stack setup - name: Stack setup
id: stack id: stack
uses: freckle/stack-action@v4 uses: freckle/stack-action@v5
with: with:
working-directory: main working-directory: main
stack-build-arguments: ${{ env.STACK_BUILD_ARGS }}
test: false test: false
- name: Install and test Juvix - name: Install and test Juvix
@ -186,8 +191,8 @@ jobs:
if: ${{ success() }} if: ${{ success() }}
run: | run: |
cd main cd main
make install just ${{ env.JUST_ARGS }} install
make test just ${{ env.JUST_ARGS }} test
- name: Typecheck and format Juvix examples - name: Typecheck and format Juvix examples
if: ${{ success() }} if: ${{ success() }}
@ -225,6 +230,8 @@ jobs:
build-and-test-macos: build-and-test-macos:
runs-on: macos-12 runs-on: macos-12
steps: steps:
- uses: extractions/setup-just@v2
- name: Checkout our repository - name: Checkout our repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -354,7 +361,7 @@ jobs:
- name: Make runtime - name: Make runtime
run: | run: |
cd main cd main
make CC=$CC LIBTOOL=$LIBTOOL runtime just ${{ env.JUST_ARGS }} build runtime
# We use the options: # We use the options:
# - -fhide-source-paths # - -fhide-source-paths
@ -372,9 +379,10 @@ jobs:
- name: Stack setup - name: Stack setup
id: stack id: stack
uses: freckle/stack-action@v4 uses: freckle/stack-action@v5
with: with:
working-directory: main working-directory: main
stack-build-arguments: ${{ env.STACK_BUILD_ARGS }}
test: false test: false
- name: Add homebrew clang to the PATH (macOS) - name: Add homebrew clang to the PATH (macOS)
@ -399,8 +407,8 @@ jobs:
if: ${{ success() }} if: ${{ success() }}
run: | run: |
cd main cd main
make CC=$CC LIBTOOL=$LIBTOOL install just ${{ env.JUST_ARGS }} install
make CC=$CC LIBTOOL=$LIBTOOL test just ${{ env.JUST_ARGS }} test
- name: Typecheck and format Juvix examples - name: Typecheck and format Juvix examples
if: ${{ success() }} if: ${{ success() }}

View File

@ -22,6 +22,17 @@ stack := "stack"
# the command used to run ormolu # the command used to run ormolu
ormolu := "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 # flags used in the stack command
stackOptFlag := if enableOptimized == '' { '--fast' } else { '' } stackOptFlag := if enableOptimized == '' { '--fast' } else { '' }
# The ghc `-j` flag defaults to number of cpus when no argument is passed # 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 # Build the juvix runtime
_buildRuntime: _buildRuntime:
cd runtime && make -j 4 -s cd runtime && make {{ runtimeArgs }} -j 4 -s
# Build the project. `build runtime` builds only the runtime. # Build the project. `build runtime` builds only the runtime.
[no-exit-message] [no-exit-message]
@ -104,10 +115,10 @@ build *opts:
case $opts in case $opts in
runtime) runtime)
just _buildRuntime just runtimeArgs="{{ runtimeArgs }}" _buildRuntime
;; ;;
*) *)
just _buildRuntime just runtimeArgs="{{ runtimeArgs }}" _buildRuntime
set -x set -x
{{ stack }} build {{ stackArgs }} {{ stack }} build {{ stackArgs }}
;; ;;