-
Notifications
You must be signed in to change notification settings - Fork 1
167 lines (147 loc) · 5 KB
/
validation-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
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
157
158
159
160
161
162
163
164
165
166
167
---
on:
push:
branches:
- main
pull_request:
name: Rust Validation
env:
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: "-D warnings"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
TARGET_DIR: ./target
jobs:
check_test:
strategy:
fail-fast: true
matrix:
include:
- name: linux x64
os: ubuntu-latest
target: x86_64-unknown-linux-musl
native: true
- name: linux aarch
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
native: false
- name: macos x64
os: macos-latest
target: x86_64-apple-darwin
native: true
- name: macos aarch
os: macos-latest
target: aarch64-apple-darwin
native: false
- name: windows msvc
os: windows-latest
target: x86_64-pc-windows-msvc
native: true
- name: windows gnu
os: windows-latest
target: x86_64-pc-windows-gnu
native: true
name: "Check ${{ matrix.name }}. test: ${{ matrix.native }}"
runs-on: ${{ matrix.os }}
env:
MAKE_DIST: "1"
steps:
- uses: actions/checkout@v4
- run: rustup default 1.70
- uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} -- -D warnings
- name: Run tests
if: matrix.native
run: cargo test --target ${{ matrix.target }}
- name: Build binary
if: matrix.native && matrix.os != 'windows-latest'
run: cargo build
- name: Test make
if: matrix.native && matrix.os != 'windows-latest'
run: |
cargo_outdir="$(find target -name mpk-stamp -print0 | xargs -0 ls -t | head -n1 | xargs dirname)"
echo outdir: "$cargo_outdir"
compdir_bash="/usr/share/bash-completion/completions"
compdir_fish="/usr/share/fish/vendor_completions.d"
compdir_zsh="/usr/share/zsh/vendor-completions"
mkdir testdir testdir/completion testdir/doc
sh dist/create_install_makefile.sh
mv Makefile.dist testdir/Makefile
mv "$cargo_outdir"/mpk.1 testdir/doc
mv "$cargo_outdir"/* testdir/completion
mv target/debug/mpk testdir
cd testdir
echo -e '\n==== running sudo make install ===='
sudo make install
echo '==== finished install ===='
echo testing files...
echo testing mpk presence...
test -f /usr/local/bin/mpk
echo testing mpk.1 presence...
test -f /usr/local/share/man/man1/mpk.1
if [ -d "$compdir_bash" ]; then
echo testing mpk bash presence...
test -f "${compdir_bash}/mpk"
fi
if [ -d "$compdir_fish" ]; then
echo testing mpk fish presence...
test -f "${compdir_fish}/mpk.fish"
fi
if [ -d "$compdir_zsh" ]; then
echo testing mpk zsh presence...
test -f "${compdir_zsh}/_mpk"
fi
echo -e '\n==== running sudo make uninstall ===='
sudo make uninstall
echo '==== finished uninstall ===='
echo testing mpk removal...
test ! -f /usr/local/bin/mpk
echo testing mpk.1 removal...
test ! -f /usr/local/share/man/man1/mpk.1
if [ -d "$compdir_bash" ]; then
echo testing mpk bash removal...
test ! -f "${compdir_bash}/mpk"
fi
if [ -d "$compdir_fish" ]; then
echo testing mpk fish removal...
test ! -f "${compdir_fish}/mpk.fish"
fi
if [ -d "$compdir_zsh" ]; then
echo testing mpk zsh removal...
test ! -f "${compdir_zsh}/_mpk"
fi
mkdir -p ~/.local
echo -e '\n==== running install with prefix ===='
make install PREFIX="~/local"
echo '==== finished install ===='
echo testing mpk presence...
test -f ~/local/bin/mpk
echo -e '\n==== running uninstall with prefix ===='
make uninstall PREFIX="~/local"
echo '==== finished uninstall ===='
echo testing mpk removal...
test ! -f ~/local/bin/mpk
fmt:
name: "Format (cargo fmt)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup default nightly && rustup component add rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
doc:
name: "Docs (cargo doc)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup default nightly
- uses: Swatinem/rust-cache@v2
- run: cargo doc --document-private-items
outdated:
name: Outdated
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
uses: taiki-e/install-action@cargo-outdated
- run: cargo outdated --workspace --exit-code 1