-
Notifications
You must be signed in to change notification settings - Fork 6
99 lines (96 loc) · 2.98 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
on: [push, pull_request]
name: Build
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
artifact_name: rabbit-digger-pro
release_name: rabbit-digger-pro-linux-amd64
- os: windows-latest
artifact_name: rabbit-digger-pro.exe
release_name: rabbit-digger-pro-windows-amd64.exe
- os: macos-latest
artifact_name: rabbit-digger-pro
release_name: rabbit-digger-pro-macos-amd64
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache Cargo
uses: actions/cache@v1
with:
path: ~/.cargo
key: ${{ matrix.os }}-stable-cargo-v1
restore-keys: |
${{ matrix.os }}-stable-cargo-v1
- name: Setup toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all --exclude raw
- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.release_name }}
tag: ${{ github.ref }}
cross_compile:
name: Cross compile
runs-on: ubuntu-latest
strategy:
matrix:
target:
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-musl
- mipsel-unknown-linux-musl
- i686-unknown-linux-musl
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache Cargo
uses: actions/cache@v1
with:
path: ~/.cargo
key: ${{ matrix.target }}-stable-cargo-v1
restore-keys: |
${{ matrix.target }}-stable-cargo-v1
- name: Setup toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build release
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target=${{ matrix.target }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/rabbit-digger-pro
asset_name: rabbit-digger-pro-${{ matrix.target }}
tag: ${{ github.ref }}