-
Notifications
You must be signed in to change notification settings - Fork 274
126 lines (108 loc) · 4.49 KB
/
ci-build-jit-binary.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: build jit binary
on:
workflow_call:
defaults:
run:
shell: bash
env:
jit_src: unison-jit-src/
jit_dist: unison-jit-dist/
racket_version: "8.14"
jobs:
build-jit-binary:
name: build jit binary
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-13, windows-2019]
runs-on: ${{matrix.os}}
steps:
- name: set up environment
run: |
jit_src="$GITHUB_WORKSPACE/${{ 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
- name: get workflow files, for checking hashes
uses: actions/checkout@v4
with:
sparse-checkout: .github
- name: download jit source
uses: actions/download-artifact@v4
with:
name: jit-source
path: ${{ env.jit_src }}
- 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-src_${{hashFiles(format('{0}/**/*.rkt',env.jit_src),format('{0}/**/*.ss',env.jit_src))}}.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}}.yaml_${{hashFiles('**/ci-build-jit-binary.yaml')}}
- name: install racket
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
uses: unisonweb/actions/racket/install@buildjet-cache
with:
version: ${{env.racket_version}}
- name: set up redistributables (macos)
if: runner.os == 'macOS' && steps.cache-jit-binaries.outputs.cache-hit != 'true'
run: |
brew install libb2
brew_lib_dir=$(brew --prefix)/lib
racket_lib_dir=$(dirname $(dirname $(readlink -f $(which raco))))/lib
# link libb2 if not already present/cached
for dll in $brew_lib_dir/libb2.*.dylib; do
file=$(basename "$dll")
if [ ! -e "$racket_lib_dir/$file" ]; then
ln -s "$brew_lib_dir/$file" "$racket_lib_dir/$file"
else
echo "$racket_lib_dir/$file" already exists.
fi
done
- name: build jit binary
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
shell: bash
run: |
if [[ ${{runner.os}} = "Windows" ]]; then
raco pkg install --auto --skip-installed --scope installation x509-lib
elif [[ ${{runner.os}} = "macOS" ]]; then
raco pkg install --auto --skip-installed --scope installation x509-lib
elif [[ ${{runner.os}} = "Linux" ]]; then
sudo raco pkg install --auto --skip-installed --scope installation x509-lib
fi
raco pkg install --auto --skip-installed "$jit_src"/unison
raco exe --embed-dlls "$jit_src"/unison-runtime.rkt
raco distribute -v "$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-src_${{hashFiles(format('{0}/**/*.rkt',env.jit_src),format('{0}/**/*.ss',env.jit_src))}}.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 }}/**
# - name: setup tmate session
# uses: mxschmitt/action-tmate@v3