-
Notifications
You must be signed in to change notification settings - Fork 13
183 lines (178 loc) · 5.86 KB
/
build.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Build
on:
create:
tags:
push:
branches:
- main
pull_request:
jobs:
build:
name: Native
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install deps (Linux)
run: |
sudo apt-get install libreadline-dev xxd libffi-dev libssl-dev
if: matrix.os == 'ubuntu-latest'
- name: Install deps (macOS)
run: |
brew install readline vim libffi openssl make
echo "$(brew --prefix)/opt/make/libexec/gnubin" >> $GITHUB_PATH
if: matrix.os == 'macos-latest'
- name: Fetch tags
run: git fetch --tags --force origin
- name: Build
run: make release
- name: Test
run: make test
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ format('tpl-{0}-{1}', runner.os, runner.arch) }}
path: |
tpl
LICENSE
ATTRIBUTION
README.md
windows:
name: Windows
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
- name: Install deps
run: |
pacman --noconfirm -S make mingw-w64-x86_64-gcc mingw-w64-x86_64-headers-git mingw-w64-x86_64-libffi mingw-w64-x86_64-dlfcn
pacman --noconfirm -S mingw-w64-x86_64-openssl vim diffutils git
- name: Configure line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force origin
- name: Build
run: make WIN=1 release
- name: Test
run: make test
- name: Make Windows-friendly
run: |
cp ${MINGW_PREFIX}/bin/{libcrypto-3-x64.dll,libssl-3-x64.dll,libffi-8.dll,libdl.dll} .
echo -e "\n\nOpenSSL (libcrypto-3-x64.dll, libssl-3-x64.dll):\n" >> ATTRIBUTION
cat ${MINGW_PREFIX}/share/licenses/openssl/LICENSE >> ATTRIBUTION
echo -e "\n\nlibffi: (libffi-8.dll)\n" >> ATTRIBUTION
cat ${MINGW_PREFIX}/share/licenses/libffi/LICENSE >> ATTRIBUTION
echo -e "\n\ndlfcn: (libdl.dll)\n" >> ATTRIBUTION
cat ${MINGW_PREFIX}/share/licenses/dlfcn/LICENSE >> ATTRIBUTION
echo -e "\n\nisocline:\n" >> ATTRIBUTION
cat src/isocline/LICENSE >> ATTRIBUTION
if [ ! -f "tpl.exe" ]; then
mv tpl tpl.exe
fi
mv ATTRIBUTION ATTRIBUTION.txt
mv LICENSE LICENSE.txt
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ format('tpl-{0}-{1}', runner.os, runner.arch) }}
path: |
tpl.exe
LICENSE.txt
ATTRIBUTION.txt
README.md
libcrypto-3-x64.dll
libssl-3-x64.dll
libffi-8.dll
libdl.dll
# Roughly matches https://github.com/WebAssembly/wasi-sdk#install
wasm:
name: WebAssembly
runs-on: ubuntu-latest
env:
WASI_VERSION: 19
BINARYEN_VERSION: 109
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force origin
- name: Set environment (1/3)
run: |
echo "WASI_VERSION_FULL=${WASI_VERSION}.0" >> $GITHUB_ENV
- name: Set environment (2/3)
run: |
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_VERSION_FULL}" >> $GITHUB_ENV
- name: Set environment (3/3)
run: |
echo "WASI_CC=${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot" >> $GITHUB_ENV
- name: Add Homebrew to $PATH
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
- name: Install WASI SDK
run: |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
tar xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
- name: Install Binaryen
run: |
brew install binaryen
- name: Setup Wasmtime
uses: mwilliamson/setup-wasmtime-action@v2
with:
wasmtime-version: "12.0.1"
- name: Build
run: make clean wasm
- name: Test
run: |
echo 'wasmtime run --max-wasm-stack 8388608 --dir . tpl.wasm -- $@' > tpl
chmod +x tpl
make test
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: tpl-wasm-wasi
path: |
tpl.wasm
LICENSE
ATTRIBUTION
README.md
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build, windows, wasm]
name: Release binaries
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: List files
run: ls -R
- name: Zip releases
run: |
cd artifacts
chmod +x */tpl* */*.wasm
for i in */; do
dir=${i%/}
lower=${dir,,}
if [ "$dir" != "$lower" ]
then
mv "$dir" "$lower"
fi
zip -r "${lower}.zip" "$lower"
done
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: 'artifacts/*.zip'