Skip to content

Commit

Permalink
try splitting jit build and test into their own workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aryairani authored Apr 26, 2024
1 parent c5b4801 commit e6c349b
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 11 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/ci-build-jit-binary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: build jit binary

on:
workflow_call:
inputs:

defaults:
run:
shell: bash

env:
jit_src: unison-jit-src/
jit_dist: unison-jit-test/

jobs:
build-jit-binary:
name: build jit binary
strategy:
fail-fast: false
matrix: os: [ubuntu-20.04, macOS-12, windows-2019]
steps:
- name: set up environment
id: checks
run: |
jit_src_scheme="${{ runner.temp }}/${{ env.jit_src }}" # scheme source
jit_exe="${jit_src}/unison-runtime" # initially built jit
jit_dist="${{ runner.temp }}/${{ env.jit_dist }}" # jit binary with libraries destination
jit_dist_exe="${jit_dist}/bin/unison-runtime" # jit binary itself
ucm="${{ runner.temp }}/unison"
if [[ ${{runner.os}} = "Windows" ]]; then
jit_src="${jit_src//\\//}"
jit_dist="${jit_dist//\\//}"
jit_exe="${jit_exe//\\//}.exe"
jit_dist_exe="${jit_dist//\\//}/unison-runtime.exe"
ucm="${ucm//\\//}.exe"
fi
echo "jit_src=$jit_src" >> $GITHUB_ENV
echo "jit_exe=$jit_exe" >> $GITHUB_ENV
echo "jit_dist=$jit_dist" >> $GITHUB_ENV
echo "jit_dist_exe=$jit_dist_exe" >> $GITHUB_ENV
echo "ucm=$ucm" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
sparse-checkout: |
# scripts/get-share-hash.sh
scheme-libs
# unison-src/builtin-tests/jit-tests.tpl.md
# unison-src/transcripts-using-base/serialized-cases/case-00.v4.ser
- name: cache/restore jit binaries
id: cache-jit-binaries
uses: actions/cache/restore@v4
with:
path: ${{ env.jit_dist }}
key: |
jit_dist-\
${{ matrix.os }}.\
racket_${{ env.racket_version }}.\
jit_${{ env.jit_version }}-${{hashFiles('**/scheme-libs/**')}}.\
yaml_${{hashFiles('**/ci-build-jit-binary.yaml')}}
- name: Cache Racket dependencies
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: |
~/.cache/racket
~/.local/share/racket
key: ${{ matrix.os }}-racket-${{env.racket_version}}

- uses: Bogdanp/[email protected]
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
with:
architecture: x64
distribution: full
variant: CS
version: ${{env.racket_version}}

- name: download jit source
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: jit-source
path: ${{ env.jit_src }}

- name: build jit binary
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
shell: bash
run: |
cp -R scheme-libs/racket/* "$jit_src"
raco pkg install --auto --skip-installed "$jit_src"/unison
raco exe --embed-dlls "$jit_src"/unison-runtime.rkt
- name: install libb2 (macos)
if: runner.os == 'macOS' && steps.cache-jit-binaries.outputs.cache-hit != 'true'
run: |
brew install libb2
ln -s "$(brew --prefix)"/lib/libb2.*.dylib \
"$(dirname "$(readlink -f "$(which raco)")")"/../lib/
- name: bundle redistributables
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
shell: bash
run: |
raco distribute "$jit_dist" "$jit_exe"
- name: cache/save jit binaries
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.jit_dist }}
key: |
jit_dist-\
${{ matrix.os }}.\
racket_${{ env.racket_version }}.\
jit_${{ env.jit_version }}-${{hashFiles('**/scheme-libs/**')}}.\
yaml_${{hashFiles('**/ci-build-jit-binary.yaml')}}
- name: save jit binary
uses: actions/upload-artifact@v4
with:
name: jit-binary-${{ matrix.os }}
path: ${{ env.jit_dist }}/**
9 changes: 9 additions & 0 deletions .github/workflows/ci-test-jit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: ci: test jit

on:
workflow_call:
inputs:
ref:
description: Git ref to check out for this build, e.g. `trunk` or `release/0.5.19`
type: string
required: true
19 changes: 8 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -417,19 +417,18 @@ jobs:
if-no-files-found: error

build-jit-binary:
if: always() && needs.generate-jit-source.result == 'success'
name: build jit binary
uses: ./.github/workflows/ci-build-jit-binary.yaml

build-jit-binary-old:
if: false && always() && needs.generate-jit-source.result == 'success'
name: build jit binary
needs: generate-jit-source
runs-on: ${{ matrix.os }}
strategy:
# Run each build to completion, regardless of if any have failed
fail-fast: false
matrix:
os:
# While iterating on this file, you can disable one or more of these to speed things up
- ubuntu-20.04
- macOS-12
- windows-2019
matrix: os: [ubuntu-20.04, macOS-12, windows-2019]
steps:
- name: set up environment
id: checks
Expand Down Expand Up @@ -468,8 +467,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ env.jit_dist }}
# don't keep this change
key: jit_dist2-${{ matrix.os }}.racket_${{ env.racket_version }}.jit_${{ env.jit_version }}-${{hashFiles('**/scheme-libs/**')}}
key: jit_dist-${{ matrix.os }}.racket_${{ env.racket_version }}.jit_${{ env.jit_version }}-${{hashFiles('**/scheme-libs/**')}}

- name: Cache Racket dependencies
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -497,8 +495,7 @@ jobs:
uses: actions/cache@v4
with:
path: ${{env.jit_test_results}}
# don't keep this change
key: jit-test-results2.${{ matrix.os }}.racket_${{ env.racket_version }}.jit_${{ env.jit_version }}-${{hashFiles('**/scheme-libs/**')}}.tests_${{env.runtime_tests_causalhash}}
key: jit-test-results.${{ matrix.os }}.racket_${{ env.racket_version }}.jit_${{ env.jit_version }}-${{hashFiles('**/scheme-libs/**')}}.tests_${{env.runtime_tests_causalhash}}

- name: download jit source
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
Expand Down

0 comments on commit e6c349b

Please sign in to comment.