-
Notifications
You must be signed in to change notification settings - Fork 3
156 lines (147 loc) · 4.44 KB
/
ci.yml
File metadata and controls
156 lines (147 loc) · 4.44 KB
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
151
152
153
154
155
156
name: CI
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- name: Update Rust
run: rustup update stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose --locked
- name: Upload artifacts for Windows
if: ${{ matrix.os == 'windows-latest'}}
uses: actions/upload-artifact@v4
with:
name: envfetch-debug-windows
path: |
target/debug/envfetch.exe
- name: Upload artifacts for Linux
if: ${{ matrix.os == 'ubuntu-latest'}}
uses: actions/upload-artifact@v4
with:
name: envfetch-debug-linux
path: |
target/debug/envfetch
- name: Upload artifacts for macOS
if: ${{ matrix.os == 'macOS-latest'}}
uses: actions/upload-artifact@v4
with:
name: envfetch-debug-macos
path: |
target/debug/envfetch
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: auguwu/clippy-action@1.4.0
with:
token: ${{secrets.GITHUB_TOKEN}}
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- name: Update rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose --locked
- name: Run tests
run: cargo test --verbose
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Rust
run: rustup update stable
- name: Main cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Bin Cache
id: bin-cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
key: ${{ runner.os }}-cargo-bin-tarpaulin
- name: Install Tarpaulin
if: steps.bin-cache.outputs.cache-hit != 'true'
run: cargo install cargo-tarpaulin
- name: Generate code coverage
run: cargo tarpaulin --out xml --locked
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
# This step is temporary disabled (see https://github.com/ankddev/envfetch/issues/52 for more information)
# - name: Install cargo2junit
# if: steps.bin-cache.outputs.cache-hit != 'true'
# run: cargo install cargo2junit
# - name: Generaete junit test file
# run: RUSTC_BOOTSTRAP=1 cargo test -- -Z unstable-options --format json --report-time | cargo2junit > junit.xml
# - name: Upload test results to Codecov
# if: ${{ !cancelled() }}
# uses: codecov/test-results-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}