-
Notifications
You must be signed in to change notification settings - Fork 12
148 lines (146 loc) · 4.71 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: rustup component add clippy
- name: cargo clippy with default features (tls)
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
- name: cargo clippy with rustls feature
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --features rustls --no-default-features -- -D warnings
- name: cargo clippy without default features
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --no-default-features -- -D warnings
test:
runs-on: ubuntu-latest
needs: clippy
steps:
- uses: actions/checkout@v1
- uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: >-
curl -sL https://api.github.com/repos/3proxy/3proxy/releases/latest |
jq -r ".assets[].browser_download_url | select(endswith(\"x86_64.deb\"))" |
xargs wget
- run: sudo dpkg -i *.deb
- run: nohup cat .github/workflows/proxy.cfg | 3proxy &
- uses: actions-rs/cargo@v1
with:
command: build
args: --all-targets
- name: Test with default features (tls)
run: RUST_BACKTRACE=1 timeout 10 cargo test --all-targets -- --test-threads=1
- uses: actions-rs/cargo@v1
with:
command: build
args: --all-targets --features rustls --no-default-features
- name: Test with rustls feature
run: RUST_BACKTRACE=1 timeout 10 cargo test --all-targets --features rustls --no-default-features -- --test-threads=1
coverage:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- run: >-
curl -sL https://api.github.com/repos/3proxy/3proxy/releases/latest |
jq -r ".assets[].browser_download_url | select(endswith(\"x86_64.deb\"))" |
xargs wget
- run: sudo dpkg -i *.deb
- run: nohup cat .github/workflows/proxy.cfg | 3proxy &
- run: cargo install grcov
- uses: allenevans/[email protected]
with:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: >-
-Zprofile
-Ccodegen-units=1
-Cinline-threshold=0
-Clink-dead-code
-Coverflow-checks=off
-Cpanic=abort
-Zpanic_abort_tests
RUSTDOCFLAGS: >-
-Zprofile
-Ccodegen-units=1
-Cinline-threshold=0
-Clink-dead-code
-Coverflow-checks=off
-Cpanic=abort
-Zpanic_abort_tests
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets --no-fail-fast
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets --no-fail-fast --features rustls --no-default-features
- uses: actions-rs/[email protected]
id: coverage
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} #required
file: ${{ steps.coverage.outputs.report }}
fail_ci_if_error: true