Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the justfile for CI builds #2730

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -176,18 +180,19 @@ 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
id: test
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() }}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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() }}
Expand Down
17 changes: 14 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -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 }}
;;
Expand Down
Loading