-
Notifications
You must be signed in to change notification settings - Fork 2
187 lines (159 loc) · 5.03 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: CI
on:
push:
pull_request:
release:
types: [published]
jobs:
commits:
name: commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: webiny/action-conventional-commits@v1.3.0
linter:
name: linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create builder image
run: docker build . -t vangelis_builder
- name: Clippy
run: >
docker run --rm
-v ${{ github.workspace }}:/workspace
vangelis_builder
cargo clippy --all --all-features -- -D warnings
- name: Format
run: >
docker run --rm
-v ${{ github.workspace }}:/workspace
vangelis_builder
cargo fmt --all -- --check
linux:
name: linux (${{ matrix.arch }})
runs-on: ubuntu-latest
permissions: write-all
needs: linter
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
include:
- arch: x86_64
target: x86_64-unknown-linux-gnu
- arch: aarch64
target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Create builder image
run: >
docker build .
-t vangelis_builder
- name: Build project
run: >
docker run --rm
-v ${{ github.workspace }}:/workspace
-e ARCH_NAME=${{ matrix.arch }}
-e TARGET_ARCH=${{ matrix.target }}
vangelis_builder
- name: Save debian artifact
uses: actions/upload-artifact@v4
with:
name: vangelis-debian-${{ matrix.arch }}.deb
path: ./vangelis-debian-${{ matrix.arch }}.deb
if-no-files-found: error
- name: Save redhat artifact
uses: actions/upload-artifact@v4
with:
name: vangelis-redhat-${{ matrix.arch }}.rpm
path: ./vangelis-redhat-${{ matrix.arch }}.rpm
if-no-files-found: error
- name: Save archlinux artifact
uses: actions/upload-artifact@v4
with:
name: vangelis-archlinux-${{ matrix.arch }}.pkg.tar.zst
path: ./vangelis-archlinux-${{ matrix.arch }}.pkg.tar.zst
if-no-files-found: error
- name: Upload packages
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
./vangelis-debian-${{ matrix.arch }}.deb
./vangelis-redhat-${{ matrix.arch }}.rpm
./vangelis-archlinux-${{ matrix.arch }}.pkg.tar.zst
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mac_os:
name: macOS (${{ matrix.arch }})
runs-on: macos-latest
permissions: write-all
needs: linter
strategy:
fail-fast: false
matrix:
arch: [intel, silicon]
include:
- arch: intel
target: x86_64-apple-darwin
- arch: silicon
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: rustup target add ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target=${{ matrix.target }}
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: vangelis-macos-${{ matrix.arch }}
path: target/${{ matrix.target }}/release/vangelis
if-no-files-found: error
- name: Set binary name
if: github.event_name == 'release'
run: cp target/${{ matrix.target }}/release/vangelis vangelis-macos-${{ matrix.arch }}
- name: Upload binary
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: vangelis-macos-${{ matrix.arch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows:
name: windows (${{ matrix.arch }})
runs-on: windows-latest
permissions: write-all
needs: linter
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
include:
- arch: x86_64
target: x86_64-pc-windows-msvc
- arch: aarch64
target: aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: rustup target add ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target=${{ matrix.target }}
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: vangelis-windows-${{ matrix.arch }}.exe
path: target/${{ matrix.target }}/release/vangelis.exe
if-no-files-found: error
- name: Set binary name
if: github.event_name == 'release'
run: cp target/${{ matrix.target }}/release/vangelis.exe vangelis-windows-${{ matrix.arch }}.exe
- name: Upload binary
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: vangelis-windows-${{ matrix.arch }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}