-
Notifications
You must be signed in to change notification settings - Fork 22
86 lines (72 loc) · 2.84 KB
/
Copy pathlinux.yml
File metadata and controls
86 lines (72 loc) · 2.84 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
name: CI - Linux - x86_64
on:
push:
branches:
- master
- v*
pull_request:
jobs:
# Evaluates the flake and builds the dev shell, so a broken flake is reported
# on its own instead of as a confusing failure inside the test job. It also
# warms the Nix store cache the test job restores.
nix:
name: Flake check
runs-on: ubuntu-latest
steps:
- uses: ossystems/nix-actions@v1
with:
install-nix: true
build_and_test:
name: Test - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
# Loads the flake's dev shell into the job, so every step below runs with
# the toolchain and the native dependencies (libarchive, protobuf, socat,
# ...) the flake pins. The dev shell is pinned to the MSRV, so the whole
# job doubles as the MSRV check.
- uses: ossystems/nix-actions@v1
with:
install-nix: true
export-devshell: true
- name: Cache build contents
uses: Swatinem/rust-cache@v2
# Every other step below enables all the features, which leaves the
# default feature set never being built. Check it on its own so a change
# guarded by a feature flag cannot break the plain `cargo build`.
- name: Check build with the default features
run: cargo check --locked --release --all --bins --examples --tests
- name: Check build
run: cargo check --locked --release --all --bins --examples --tests --all-features
- name: Tests
timeout-minutes: 10
run: cargo test --locked --release --all --all-features --no-fail-fast -- --nocapture
- name: Run listener test
run: |
export UH_LISTENER_TEST=updatehub-statechange.sock
cargo run --example listener &
while [ ! -S "$UH_LISTENER_TEST" ]; do
sleep 1
done
if [[ "$(echo "download" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "cancel" ]]; then
echo "Unexpected download response"
exit 1
fi
if [[ "$(echo "install" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
echo "Unexpected install response"
exit 2
fi
if [[ "$(echo "error" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
echo "Unexpected error response"
exit 3
fi
if [[ "$(echo "reboot" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
echo "Unexpected reboot response"
exit 4
fi
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info