-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (113 loc) · 3.7 KB
/
ci.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
name: Test & Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain: [stable, nightly]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
name: Test - ${{ matrix.os }}/${{ matrix.toolchain }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
default: true
profile: minimal
components: clippy
- uses: actions/cache@v3
id: cache
with:
path: target
key: cache-${{ matrix.os }}-${{ matrix.toolchain }}-${{ hashFiles('Cargo.lock') }}
restore-keys: cache-${{ matrix.os }}-${{ matrix.toolchain }}-
- name: Run clippy
uses: actions-rs/clippy-check@v1
if: matrix.toolchain == 'stable'
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- name: Check all possible feature combos
if: matrix.toolchain == 'stable'
run: ./test.sh 2>&1
- name: Run clippy
if: matrix.toolchain != 'stable'
run: cargo clippy --all-features
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
profile: [base, roland]
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
profile: base
- os: windows-latest
target: x86_64-pc-windows-msvc
profile: roland
runs-on: ${{ matrix.os }}
continue-on-error: false
name: Build - ${{ matrix.profile }}/${{ matrix.target }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
target: ${{ matrix.target }}
- name: Calculate features
id: features
shell: bash
run: python3 features.py ${{ matrix.os }} ${{ matrix.profile }} >> "$GITHUB_OUTPUT"
- uses: actions/cache@v3
id: cache
with:
path: target
key: ${{ matrix.profile }}/${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ matrix.profile }}/${{ matrix.target }}-
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ startsWith(matrix.target, 'aarch') || startsWith(matrix.target, 'arm') || endsWith(matrix.target, 'musl') }}
command: build
args: --release -p roblib-server --verbose --target ${{ matrix.target }} --features ${{ steps.features.outputs.f }}
- name: Rename file
shell: bash
run: |
[ ${{ matrix.os }} = "windows-latest" ] && EXT='.exe' || EXT=''
cp -v target/${{ matrix.target }}/release/roblib-server$EXT roblib-server-${{ matrix.profile }}$EXT
- name: Upload
uses: actions/upload-artifact@v3
with:
name: roblib-server-${{ matrix.profile }}-${{ matrix.target }}
path: |
roblib-server-${{ matrix.profile }}${{ startsWith(matrix.os, 'windows') && '.exe' || '' }}
if-no-files-found: error
link:
runs-on: ubuntu-latest
needs: build
steps:
- uses: beni69/artifact-link@v1
with:
token: ${{ github.token }}
group: ^roblib-server-(?<col>\w+)-(?<row>[\w-]+)$