-
Notifications
You must be signed in to change notification settings - Fork 1
155 lines (141 loc) · 3.78 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
on:
pull_request:
push:
branches:
- main
tags:
- 'v*'
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace --all-features
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: stable
- uses: clechasseur/rs-clippy-check@v3
build:
name: Build library
runs-on: ${{ matrix.os }}
needs:
- check
- 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-2022
artifact-name: windows
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
with:
key: ${{ join( matrix.os, '-' ) }}
- name: Build
run: cargo build --release
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: quicksync-${{ matrix.artifact-name }}
path: |
target/release/quicksync${{ matrix.os == 'windows-2022' && '.exe' || '' }}
if-no-files-found: error
test:
runs-on: ${{ matrix.os }}
needs:
- check
- fmt
- clippy
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- ubuntu-latest-arm-8-cores
- macos-13
- [self-hosted, macos, arm64]
- windows-2022
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/[email protected]
- run: cargo test
coverage:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/[email protected]
- run: cargo install cargo-tarpaulin
- name: Run coverage
run: cargo tarpaulin --exclude-files src/main.rs --out Lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
name: Publish release
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
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 }}