-
Notifications
You must be signed in to change notification settings - Fork 14
123 lines (115 loc) · 2.92 KB
/
build.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
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
rustup set profile default
rustup show
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install pre-commit
run: |
pip install pre-commit
pre-commit install --config .pre-commit-config.actions.yaml
- name: pre-commit
run: |
pre-commit run --config .pre-commit-config.actions.yaml --all-files --show-diff-on-failure
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
rustup set profile default
rustup show
- run: cargo fetch --verbose
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features -- -D warnings
test:
runs-on: ${{ matrix.os.long }}
strategy:
matrix:
os:
- long: ubuntu-latest
short: linux
- long: macOS-latest
short: mac
- long: windows-latest
short: win
fail-fast: false
steps:
- uses: actions/checkout@v3
- run: |
rustup set profile minimal
rustup show
- run: cargo fetch --verbose
- run: cargo build --tests
- run: cargo test --all
shell: bash
env:
RUST_LOG: trace
RUST_BACKTRACE: 1
build:
runs-on: ${{ matrix.os.long }}
strategy:
matrix:
os:
- long: ubuntu-latest
short: linux
- long: macOS-latest
short: mac
- long: windows-latest
short: win
fail-fast: false
steps:
- uses: actions/checkout@v3
- run: |
rustup set profile minimal
rustup show
- run: cargo fetch --verbose
- run: cargo check
env:
RUSTFLAGS: -D warnings
- run: cargo build
- name: Archive
shell: bash
working-directory: target/debug
run: |
VERSION=$(./git-trim --version | cut -d ' ' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
rm -rf artifacts
mkdir -p artifacts
cp 'git-trim' artifacts/
echo '${{github.sha}} ${{github.ref}}' | tee artifacts/git-ref
if command -v sha256sum; then
sha256sum 'git-trim' | tee artifacts/sha256sums
else
shasum -a 256 'git-trim' | tee artifacts/sha256sums
fi
- uses: actions/upload-artifact@v3
with:
name: git-trim-${{matrix.os.short}}-${{env.VERSION}}
path: target/debug/artifacts/
docs-are-up-to-date:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
rustup set profile minimal
rustup show
- run: cargo fetch --verbose
- run: ./build-man.sh build
- run: ./build-man.sh run
- name: Check docs are up-to-date
run: git diff --exit-code HEAD -- docs