-
Notifications
You must be signed in to change notification settings - Fork 286
207 lines (191 loc) · 7.64 KB
/
release-libsql.yml
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Create and publish libsql binaries
on:
push:
#branches: ['main']
tags:
- libsql-sqlite3-v*.*.*
jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-0e811aad4d084edb9
ec2-instance-type: t4g.2xlarge
subnet-id: subnet-05010d45bfb86f5fb
security-group-id: sg-01bd3845621443669
build_binaries:
needs: start-runner
strategy:
matrix:
os:
- ubuntu-latest
- macos-14
- ${{ needs.start-runner.outputs.label }}
variant:
- 'wasm-udf-dynamic'
- 'wasm-udf-wasmedge'
- 'wasm-udf'
- ''
runs-on: ${{ matrix.os }}
steps:
#Debug output + special rustup config for the ubuntu/aarch64 runner
- name: show step matrix details
run: |
env
set -ex
uname -a
echo "os: ${{ matrix.os }}"
echo "variant: ${{ matrix.variant }}"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ./rustup.sh
chmod a+x rustup.sh
./rustup.sh -y
if [[ "${{ matrix.os}}" == "${{ needs.start-runner.outputs.label }}" ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
echo "PATH=$PATH:/root/.cargo/bin" >> $GITHUB_PATH
fi
pwd
whoami
#for windows only, use correct newlines
- name: Set git to use LF
if: matrix.os == 'windows-latest'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: setup msys2 for windows
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-sqlite3 gcc make base-devel mingw-w64-x86_64-rust zip
msystem: mingw64
path-type: inherit
- name: run configure
working-directory: libsql-sqlite3
run: |
set -ex
mkdir build
pushd build
case "${{ matrix.variant }}" in
"wasm-udf-dynamic")
../configure --enable-wasm-runtime-dynamic
;;
"wasm-udf-wasmedge")
# Fix for https://github.com/WasmEdge/WasmEdge/issues/2622
if [[ "${{ matrix.os}}" == "${{ needs.start-runner.outputs.label }}" ]]; then
curl -SLO https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh
chmod a+x install.sh
./install.sh --dist manylinux2014 -D
else
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
fi
source ~/.wasmedge/env
../configure --enable-wasm-runtime-wasmedge
;;
"wasm-udf")
../configure --enable-wasm-runtime
;;
*)
../configure
;;
esac
popd
- name: build
working-directory: libsql-sqlite3
run: |
set -ex
if [[ "${{ matrix.variant }}" == "wasm-udf-wasmedge" ]]; then
source ~/.wasmedge/env || echo "no wasmedge installed"
fi
pushd build
make
make sqlite3.c
ls -la
popd
- name: package artefacts (for named variants)
working-directory: libsql-sqlite3
if: matrix.variant != ''
run: |
set -ex
uname -a
OS=$(uname -s)
ARCH=$(uname -m)
cd build
tar cvzf libsql-${{ github.ref_name }}-${{ matrix.variant }}-$OS-$ARCH.tar.gz .libs libsql sqlite3
tar cvzf libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-$OS-$ARCH.tar.gz sqlite3.c sqlite3.h
ls -la
cd ..
- name: package artefacts
working-directory: libsql-sqlite3
if: matrix.variant == ''
run: |
set -ex
uname -a
OS=$(uname -s)
ARCH=$(uname -m)
cd build
tar cvzf libsql-${{ github.ref_name }}-$OS-$ARCH.tar.gz .libs libsql sqlite3
tar cvzf libsql-amalgamation-${{ github.ref_name }}-$OS-$ARCH.tar.gz sqlite3.c sqlite3.h
ls -la
cd ..
- name: Push artefacts into release draft
working-directory: libsql-sqlite3
uses: softprops/action-gh-release@v1
if: ${{startsWith(github.ref, 'refs/tags/') }}
with:
fail_on_unmatched_files: false
files: |
build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Linux-x86_64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Linux-x86_64.tar.gz
build/libsql-${{ github.ref_name }}-Linux-x86_64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-Linux-x86_64.tar.gz
build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Linux-aarch64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Linux-aarch64.tar.gz
build/libsql-${{ github.ref_name }}-Linux-aarch64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-Linux-aarch64.tar.gz
build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-x86_64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-x86_64.tar.gz
build/libsql-${{ github.ref_name }}-Darwin-x86_64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-Darwin-x86_64.tar.gz
build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-arm64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-arm64.tar.gz
build/libsql-${{ github.ref_name }}-Darwin-arm64.tar.gz
build/libsql-amalgamation-${{ github.ref_name }}-Darwin-arm64.tar.gz
stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- build_binaries # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}