-
Notifications
You must be signed in to change notification settings - Fork 15
101 lines (95 loc) · 2.54 KB
/
ci.yaml
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
on:
# Allows running manually from Actions tab
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- 'v*.*.*'
name: Rust CI
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
name: Clippy Output
release:
name: Release ${{ matrix.target }}
needs: [check, fmt, clippy]
env:
PROJECT_NAME_UNDERSCORE: rustpad
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
include:
- name: x64-linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
extension:
upx_args: --best --lzma
- name: x64-windows
os: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe
upx_args: -9
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Release Build
run: cargo build --release --target ${{ matrix.target }}
- name: 'Compress Binary'
uses: svenstaro/upx-action@v2
with:
files: target/${{ matrix.target }}/release/${{ env.PROJECT_NAME_UNDERSCORE }}${{ matrix.extension }}
args: ${{ matrix.upx_args }}
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: ${{ env.PROJECT_NAME_UNDERSCORE }}
path: target/${{ matrix.target }}/release/${{ env.PROJECT_NAME_UNDERSCORE }}${{ matrix.extension }}