-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (124 loc) · 3.57 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
on:
pull_request:
push:
tags:
- 'v*'
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@1.74.1
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace --all-features
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.74.1
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Annotate commit with clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --workspace
build:
name: Build library
runs-on: ${{ matrix.os }}
needs:
- fmt
- clippy
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact-name: linux
- os: ubuntu-latest-arm-8-cores
artifact-name: linux-arm64
- os: [self-hosted, macos, arm64]
artifact-name: macos-arm64
- os: macos-13
artifact-name: macos
- os: windows-2019
artifact-name: windows
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.74.1
- uses: Swatinem/rust-cache@v2
with:
key: ${{ join( matrix.os, '-' ) }}
- name: Install SQLite3 (Linux Arm64)
if: matrix.artifact-name == 'linux-arm64'
run: sudo apt-get install libsqlite3-dev
- name: Install SQLite3 (Windows)
if: matrix.artifact-name == 'windows'
run: |
choco install -y wget
cd C:\
mkdir lib
cd lib
wget https://github.com/buggins/ddbc/raw/master/libs/win64/sqlite3.lib
echo "LIB=C:\lib" >> $env:GITHUB_ENV
- name: Build
run: cargo build --release
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: quicksync-${{ matrix.artifact-name }}
path: |
target/release/quicksync${{ matrix.os == 'windows-2019' && '.exe' || '' }}
if-no-files-found: error
release:
name: Publish release
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts
- name: List artifacts
run: ls -R ./artifacts
- name: Create a draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Pack artifacts
run: >
mkdir ./assets;
for dir in ./artifacts/*/; do
zip -o -j -r "./assets/$(basename "$dir")-$TAG.zip" "$dir";
done
env:
TAG: ${{ github.ref_name }}
- name: Upload Release Assets
run: gh release upload $TAG ./assets/*.zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}