-
Notifications
You must be signed in to change notification settings - Fork 9
172 lines (160 loc) · 5.68 KB
/
ci.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
name: CI
on:
pull_request:
push:
jobs:
test:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- run: sudo apt install -y libsqlite3-mod-spatialite
- run: cargo test --features sqlite
- run: cargo test --features sqlcipher
- id: version
run: |
version=$(grep "^version" Cargo.toml | sed 's/version = "//g' | sed 's/"//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
build-pc: # Windows 8+
runs-on: windows-latest
strategy:
matrix:
include:
- target: aarch64-pc-windows-msvc # NOTE: aarch64-win7-windows-msvc does not exist
vsce_target: win32-arm64
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: ${{ matrix.target }}
- run: |
$ErrorActionPreference = "Stop"
rustup target add ${{ matrix.target }}
cargo build --release --features sqlite --target ${{ matrix.target }}
cp target/${{ matrix.target }}/release/sqlite3-editor.exe sqlite3-editor-${{ matrix.vsce_target }}.exe
- uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.vsce_target }}.exe
path: sqlite3-editor-${{ matrix.vsce_target }}.exe
retention-days: 1
build-win7: # Windows 7+
runs-on: windows-latest
strategy:
matrix:
include:
- target: x86_64-win7-windows-msvc
vsce_target: win32-x64
- target: i686-win7-windows-msvc
vsce_target: win32-ia32
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-05-16
# prebuilt toolchains are unavailable for win7 targets
# backtrace\src\symbolize\dbghelp.rs:111:9 failed to compile with the latest version of nightly Rust.
- run: |
$ErrorActionPreference = "Stop"
rustup +nightly-2024-05-16 component add rust-src
cargo +nightly-2024-05-16 build -Z build-std --release --features sqlite --target ${{ matrix.target }}
cp target/${{ matrix.target }}/release/sqlite3-editor.exe sqlite3-editor-${{ matrix.vsce_target }}.exe
- name: Test
run: target/${{ matrix.target }}/release/sqlite3-editor.exe version
if: ${{ matrix.target == 'x86_64-win7-windows-msvc' }}
- uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.vsce_target }}.exe
path: sqlite3-editor-${{ matrix.vsce_target }}.exe
retention-days: 1
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
vsce_target: linux-x64-gnu
- target: x86_64-unknown-linux-musl
vsce_target: linux-x64-musl
- target: aarch64-unknown-linux-gnu
vsce_target: linux-arm64-gnu
- target: aarch64-unknown-linux-musl
vsce_target: linux-arm64-musl
- target: armv7-unknown-linux-gnueabihf
vsce_target: linux-arm-gnu
- target: arm-unknown-linux-musleabi
vsce_target: linux-arm-musl
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: ${{ matrix.target }}
- run: cargo install cross --git https://github.com/cross-rs/cross
- run: |
set -xEeuo pipefail
# https://github.com/cross-rs/cross/wiki/FAQ#exec-format-error
docker run --privileged --rm tonistiigi/binfmt --install all
rustup override set nightly
rustup update
cross build --release --features sqlite --target ${{ matrix.target }}
cp target/${{ matrix.target }}/release/sqlite3-editor sqlite3-editor-${{ matrix.vsce_target }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.vsce_target }}
path: sqlite3-editor-${{ matrix.vsce_target }}
retention-days: 1
build-darwin:
runs-on: macos-latest
strategy:
matrix:
include:
- target: x86_64-apple-darwin
vsce_target: darwin-x64
- target: aarch64-apple-darwin
vsce_target: darwin-arm64
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: ${{ matrix.target }}
- run: |
set -xEeuo pipefail
cargo build --release --features sqlite --target ${{ matrix.target }}
cp target/${{ matrix.target }}/release/sqlite3-editor sqlite3-editor-${{ matrix.vsce_target }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.vsce_target }}
path: sqlite3-editor-${{ matrix.vsce_target }}
retention-days: 1
release:
needs:
- build-win7
- build-pc
- build-linux
- build-darwin
- test
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- run: |
for i in ./artifact-*/*
do cp -r "$i" .
done
chmod a+x ./sqlite3-editor-*
tar -cvf sqlite3-editor.tar ./sqlite3-editor-*
- uses: softprops/action-gh-release@v1
with:
files: 'sqlite3-editor.tar'
name: ${{ needs.test.outputs.version }}
tag_name: ${{ needs.test.outputs.version }}
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}