-
Notifications
You must be signed in to change notification settings - Fork 4
150 lines (138 loc) · 3.86 KB
/
rust.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
name: Rust
on:
push:
branches: [main]
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
jobs:
checks:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- 1.70.0
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-${{ matrix.toolchain }}
- name: Build
run: cargo build --tests
- name: Run tests
run: |
cargo test --lib
cargo test --doc
- name: clippy
run: cargo clippy -- --deny "warnings"
- name: fmt
run: cargo fmt -- --check
linux-binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.70.0
target: x86_64-unknown-linux-musl
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.70.0-binary
workspaces: |
.
- name: Install musl tools
run: sudo apt-get update -y && sudo apt-get install -y musl-tools
- name: Build
run: |
cargo build --release --target x86_64-unknown-linux-musl
strip target/x86_64-unknown-linux-musl/release/rucredstash
- name: Rename
run: |
mkdir artifacts
cp target/x86_64-unknown-linux-musl/release/rucredstash artifacts/rucredstash-x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v2
with:
name: binaries
path: artifacts/*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/rucredstash-x86_64-unknown-linux-musl
generate_release_notes: true
macos-binary:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.70.0
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.70.0-binary
- name: Build
run: cargo build --release
- name: Rename
run: |
mkdir artifacts
cp target/release/rucredstash artifacts/rucredstash-x86_64-apple-darwin
- uses: actions/upload-artifact@v2
with:
name: binaries
path: artifacts/*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/rucredstash-x86_64-apple-darwin
generate_release_notes: true
windows-binary:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.70.0
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.70.0-binary
- name: Build
run: cargo build --release
- name: Rename
run: |
mkdir artifacts
cp target/release/rucredstash.exe artifacts/rucredstash-x86_64-pc-windows-gnu.exe
- uses: actions/upload-artifact@v2
with:
name: binaries
path: artifacts/*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/rucredstash-x86_64-pc-windows-gnu.exe
generate_release_notes: true