-
Notifications
You must be signed in to change notification settings - Fork 114
150 lines (128 loc) · 3.77 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: CI
on:
push:
branches: [master]
tags: ["helium-wallet-v*"]
pull_request:
branches: [master]
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10
jobs:
hygiene:
runs-on: ubuntu-latest
steps:
- name: Setup | Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Setup | Checkout
uses: actions/checkout@v4
- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Setup | Tools
run: sudo apt-get install -y protobuf-compiler
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
- name: Build | Hygiene
run: |
cargo fmt -- --check
cargo clippy --all-features --locked -- -D clippy::all
- name: Build | Test
run: |
cargo test
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Setup | Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Setup | Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup | Tools
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y protobuf-compiler
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install protobuf
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup | Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Build | Compile
run: cargo build --all --locked --release
- name: Build | Name
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
ARCH=x86-64-linux
elif [ "$RUNNER_OS" == "macOS" ]; then
ARCH=x86-64-macos
else
echo "$RUNNER_OS not supported"
exit 1
fi
echo "NAME=helium-wallet-${ARCH}" >> $GITHUB_ENV
- name: Build | Package
shell: bash
run: |
mkdir $NAME
mv target/release/helium-wallet $NAME/
cp README.md $NAME/
cp LICENSE $NAME/
if [ "$RUNNER_OS" == "Linux" ]; then
tar -zcvf $NAME.tar.gz $NAME/
sha256sum -b --tag $NAME.tar.gz > $NAME.checksum
elif [ "$RUNNER_OS" == "macOS" ]; then
gtar -zcvf $NAME.tar.gz $NAME/
shasum -a 256 -b --tag $NAME.tar.gz > $NAME.checksum
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Build | Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.NAME }}
if-no-files-found: error
path: helium-wallet-*
release:
if: startsWith(github.ref, 'refs/tags/helium-wallet')
needs: [hygiene, build]
runs-on: ubuntu-latest
steps:
- name: Setup | Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Setup | Artifacts
uses: actions/download-artifact@v4
with:
path: helium-wallet-*
- name: Release | Artifacts
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fail_on_unmatched_files: true
name: ${{github.ref_name}}
files: |
**/helium-wallet-*