-
Notifications
You must be signed in to change notification settings - Fork 9
executable file
·148 lines (136 loc) · 3.95 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
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.79.0
- stable
- nightly
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-${{ matrix.toolchain }}
- name: Build
run: cargo build
- name: Run tests
run: cargo test
- 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: taiki-e/install-action@v2
with:
tool: [email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.79.0
components: clippy, rustfmt
targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.79.0-binary
- name: Install musl tools
run: sudo apt-get install -y musl-tools
- name: Build (x86)
run: |
cargo build --release --target x86_64-unknown-linux-musl
strip target/x86_64-unknown-linux-musl/release/amber
- name: Build (ARM64)
run: cross build --release --target aarch64-unknown-linux-musl
- name: Rename
run: |
mkdir artifacts
cp target/x86_64-unknown-linux-musl/release/amber artifacts/amber-x86_64-unknown-linux-musl
cp target/aarch64-unknown-linux-musl/release/amber artifacts/amber-aarch64-unknown-linux-musl
- uses: actions/upload-artifact@v4
with:
name: binaries
path: artifacts/*
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/amber-x86_64-unknown-linux-musl
generate_release_notes: true
macos-binary:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.79.0
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.79.0-binary
- name: Build
run: cargo build --release
- name: Rename
run: |
mkdir artifacts
cp target/release/amber artifacts/amber-x86_64-apple-darwin
- uses: actions/upload-artifact@v4
with:
name: binaries
path: artifacts/*
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/amber-x86_64-apple-darwin
generate_release_notes: true
windows-binary:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.79.0
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.79.0-binary
- name: Build
run: cargo build --release
- name: Rename
run: |
mkdir artifacts
cp target/release/amber.exe artifacts/amber-x86_64-pc-windows-gnu.exe
- uses: actions/upload-artifact@v4
with:
name: binaries
path: artifacts/*
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/amber-x86_64-pc-windows-gnu.exe
generate_release_notes: true