-
Notifications
You must be signed in to change notification settings - Fork 97
127 lines (109 loc) · 2.96 KB
/
rust.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Rust
on:
workflow_dispatch:
push:
branches:
- master
- staging
tags:
- "*"
pull_request:
paths:
- "rust/**"
- Cargo.toml
- Cargo.lock
- scripts/ci_prepare_rust.bash
- scripts/ci_build_rust.bash
- .github/workflows/rust.yaml
jobs:
lint:
name: Format and lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: ./scripts/ci_prepare_rust.bash
shell: bash
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
name: Format Check
with:
command: fmt
args: -- --check
- uses: actions-rs/cargo@v1
name: Lint Check
with:
command: clippy
args: --all-features --all-targets -- -D warnings
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: ./scripts/ci_prepare_rust.bash
shell: bash
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run tests
run: make test-rust
build:
name: Build binaries
needs: [ lint, test ]
strategy:
matrix:
os:
- ubuntu-20.04
- macos-12
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: ./scripts/ci_prepare_rust.bash
shell: bash
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Fetch Tags
run: git fetch --tags --prune --force
- name: Build ${{ matrix.os }} binaries
id: build
run: ./scripts/ci_build_rust.bash
shell: bash
- name: Upload Release
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*.zip"
tag: ${{ github.ref }}
overwrite: true
file_glob: true
registry:
if: startsWith(github.ref, 'refs/tags/v')
needs: [ build ]
name: Publish rust release to package-registry
runs-on: ubuntu-latest
steps:
- name: Store tags
shell: bash
run: echo "VERSION=${GITHUB_REF##refs/tags/}" >> $GITHUB_ENV
- name: Hook into package registry
uses: swift-nav/swift-cli-publisher@v2
env:
DL_LINUX: "sbp_tools-${{ env.VERSION }}-x86_64-unknown-linux-musl.zip"
DL_MAC: "sbp_tools-${{ env.VERSION }}-x86_64-apple-darwin.zip"
DL_WIN: "sbp_tools-${{ env.VERSION }}-x86_64-pc-windows-msvc.zip"
TOOLS: "sbp2json,json2sbp,json2json"
with:
token: ${{ secrets.GH_TOKEN }}
gh-name: ${{ secrets.GH_NAME }}
gh-email: ${{ secrets.GH_EMAIL }}