-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (173 loc) · 5.82 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: CI
on:
push:
pull_request:
release:
types: [published]
jobs:
commits:
name: commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: webiny/action-conventional-commits@v1.1.0
linter:
name: linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Clippy
run: cargo clippy --all --all-features -- -D warnings
- name: Format
run: cargo fmt --all -- --check
tests:
name: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and install binary
run: cargo install --path .
- name: Run tests
working-directory: tests
run: ./run_tests.sh
linux:
name: linux (${{ matrix.arch_name }})
runs-on: ubuntu-latest
permissions: write-all
needs: tests
strategy:
fail-fast: false
matrix:
arch: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
include:
- arch: x86_64-unknown-linux-gnu
arch_name: x86_64
compiler: gcc-aarch64-linux-gnu
- arch: aarch64-unknown-linux-gnu
arch_name: aarch64
compiler: gcc-aarch64-linux-gnu
steps:
- uses: actions/checkout@v3
- name: Install toolchain
run: rustup target add ${{ matrix.arch }}
- name: Install build dependencies
run: >
sudo apt update && sudo apt install -y
${{ matrix.compiler }}
ruby
ruby-dev
rubygems
rpm
libarchive-tools
- name: Install fpm
run: sudo gem install fpm
- name: Build binary
run: cargo build --release --target=${{ matrix.arch }}
- name: Get binary
run: cp target/${{ matrix.arch }}/release/embin .
- name: Build debian package
run: fpm -t deb -p embin-debian-${{ matrix.arch_name }}.deb --architecture ${{ matrix.arch }}
- name: Save debian artifact
uses: actions/upload-artifact@v3
with:
name: embin-debian-${{ matrix.arch_name }}.deb
path: ./embin-debian-${{ matrix.arch_name }}.deb
if-no-files-found: error
- name: Build redhat package
run: fpm -t rpm -p embin-redhat-${{ matrix.arch_name }}.rpm --architecture ${{ matrix.arch }}
- name: Save redhat artifact
uses: actions/upload-artifact@v3
with:
name: embin-redhat-${{ matrix.arch_name }}.rpm
path: ./embin-redhat-${{ matrix.arch_name }}.rpm
if-no-files-found: error
- name: Build archlinux package
run: fpm -t pacman -p embin-archlinux-${{ matrix.arch_name }}.pkg.tar.zst --architecture ${{ matrix.arch }}
- name: Save archlinux artifact
uses: actions/upload-artifact@v3
with:
name: embin-archlinux-${{ matrix.arch_name }}.pkg.tar.zst
path: ./embin-archlinux-${{ matrix.arch_name }}.pkg.tar.zst
if-no-files-found: error
- name: Upload packages
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
./embin-debian-${{ matrix.arch_name }}.deb
./embin-redhat-${{ matrix.arch_name }}.rpm
./embin-archlinux-${{ matrix.arch_name }}.pkg.tar.zst
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mac_os:
name: macOS (${{ matrix.arch_name }})
runs-on: macos-latest
permissions: write-all
needs: tests
strategy:
fail-fast: false
matrix:
arch: [x86_64-apple-darwin, aarch64-apple-darwin]
include:
- arch: x86_64-apple-darwin
arch_name: intel
- arch: aarch64-apple-darwin
arch_name: silicon
steps:
- uses: actions/checkout@v3
- name: Install toolchain
run: rustup target add ${{ matrix.arch }}
- name: Build binary
run: cargo build --release --target=${{ matrix.arch }}
- name: Save artifact
uses: actions/upload-artifact@v3
with:
name: embin-macos-${{ matrix.arch_name }}
path: target/${{ matrix.arch }}/release/embin
if-no-files-found: error
- name: Set binary name
if: github.event_name == 'release'
run: cp target/${{ matrix.arch }}/release/embin embin-macos-${{ matrix.arch_name }}
- name: Upload binary
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: embin-macos-${{ matrix.arch_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows:
name: windows (${{ matrix.arch_name }})
runs-on: windows-latest
permissions: write-all
needs: tests
strategy:
fail-fast: false
matrix:
arch: [x86_64-pc-windows-msvc, aarch64-pc-windows-msvc]
include:
- arch: x86_64-pc-windows-msvc
arch_name: x86_64
- arch: aarch64-pc-windows-msvc
arch_name: aarch64
steps:
- uses: actions/checkout@v3
- name: Install toolchain
run: rustup target add ${{ matrix.arch }}
- name: Build binary
run: cargo build --release --target=${{ matrix.arch }}
- name: Save artifact
uses: actions/upload-artifact@v3
with:
name: embin-windows-${{ matrix.arch_name }}.exe
path: target/${{ matrix.arch }}/release/embin.exe
if-no-files-found: error
- name: Set binary name
if: github.event_name == 'release'
run: cp target/${{ matrix.arch }}/release/embin.exe embin-windows-${{ matrix.arch_name }}.exe
- name: Upload binary
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: embin-windows-${{ matrix.arch_name }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}