-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (115 loc) · 3.93 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
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
JUST_VERBOSE: 1
RUSTFLAGS: "--deny warnings" # Fail on all warnings
defaults:
run:
shell: bash
jobs:
Checks:
runs-on: ubuntu-latest
env:
CARGO_TERM_VERBOSE: true
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- name: Print Tool versions
run: just env
- name: run pre-commit
run: |
pip install pre-commit
pre-commit run --all-files
- name: Check
run: cargo check
- name: Clippy
run: cargo clippy --all --all-targets --no-deps
- name: Check Format
run: cargo fmt --all -- --check
- name: Check docs
run: cargo doc --no-deps
- name: Audit
run: cargo audit || echo "Vulnerability discovered... update now or when a fix is available"
# Lint (check/clippy) of feature combinations
- uses: taiki-e/install-action@cargo-hack
- name: Check feature combinations
run: cargo hack check --feature-powerset --no-dev-deps
- name: Clippy feature combinations
run: cargo hack clippy --feature-powerset --no-dev-deps
- name: Install shellcheck
run: sudo apt-get update && sudo apt-get install shellcheck
- name: Check Install Script
run: shellcheck www/install.sh
Test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: extractions/setup-just@v2
- name: Print Tool versions (unix)
if: ${{ matrix.os != 'windows-latest' }}
run: just env
- name: Print Tool versions (windows)
if: ${{ matrix.os == 'windows-latest' }}
# Only print rust version until the day more info is needed
run: rustc --version
- uses: taiki-e/install-action@nextest
- name: Default test
run: cargo nextest run --failure-output=immediate-final
# Build all feature combinations
- uses: taiki-e/install-action@cargo-hack
- name: Build
run: cargo hack build --feature-powerset --verbose
# Test all feature combinations
- name: Run Native Tests
run: cargo hack nextest run --feature-powerset --failure-output=immediate-final
# Run very involved tests targetting a docker container
# includes e.g.
# * Discovering and resolving an mDNS service broadcasting from within the container
# * SSH authenticating into the container, spinning up qft through ssh,
# querying for a free TCP port and finally completing a transfer via TCP.
- name: Run Container Tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
mkdir -p ~/.ssh
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""
just mkdir-container-tmp
just d-setup-for-transfer-tests
cargo nextest run --run-ignored all container_tests --no-capture --cargo-verbose
- name: Inspect Test container on failure
if: ${{ matrix.os == 'ubuntu-latest' && failure() }}
run: docker inspect alpine-qft-ssh
- name: Test install.sh
run: |
bash www/install.sh --to /tmp --tag 0.2.0
/tmp/qft --version
Docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install `mdbook` & `mdbook-linkcheck`
run: cargo install mdbook mdbook-linkcheck
- name: Build book - Generate chapters
working-directory: crates/generate-book
run: cargo run
- name: Build book - build site
run: mdbook build book
- name: Deploy Pages
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/master'
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_branch: gh-pages
publish_dir: www