-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (141 loc) · 6.03 KB
/
Copy pathci.yml
File metadata and controls
163 lines (141 loc) · 6.03 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
157
158
159
160
161
162
163
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: rustfmt, clippy
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Install Linux system dependencies
if: runner.os == 'Linux'
# libudev-dev: serialport クレートが Linux で libudev-sys に依存するため必須
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-dev libxkbcommon-dev libwayland-dev \
libasound2-dev libpulse-dev \
libudev-dev
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy (warnings as errors)
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Build
run: cargo build --workspace --all-targets
- name: Run tests
run: cargo test --workspace --all-targets
# Windows ConPTY integration tests
test-conpty:
name: Test ConPTY (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run ConPTY integration tests
run: cargo test --package nexterm-server --test '*' -- --nocapture
security:
name: Security audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run security audit
# ignore リストは deny.toml と .cargo/audit.toml で管理しているが、
# cargo-audit は `~/.cargo/audit.toml` (グローバル) しか読まないため、
# CI では --ignore フラグで明示する。
# RUSTSEC-2023-0071: rsa Marvin Attack (russh 0.60 経由、constant-time 実装移行待ち)
# RUSTSEC-2026-0194/0195: quick-xml DoS (notify-rust 経由・外部入力をパースしない。
# 上流の quick-xml 0.41 対応待ち)
run: >-
cargo audit
--ignore RUSTSEC-2023-0071
--ignore RUSTSEC-2026-0194
--ignore RUSTSEC-2026-0195
# Sprint 4-3: cargo-deny によるライセンス・依存ポリシーチェック
# 設定: deny.toml
deny:
name: cargo-deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Run cargo-deny
uses: EmbarkStudios/cargo-deny-action@91bf2b620e09e18d6eb78b92e7861937469acedb # v2.0.17
with:
command: check
# advisories / licenses / bans / sources を全てチェック
arguments: --all-features
rust-version: stable
# Sprint 5-3 / I5: cargo-llvm-cov によるテストカバレッジ計測
# 目標 20%(現状 1.7% 推定)。lcov 形式で artifact 保存し、
# サマリーは GitHub Actions のステップサマリに出力する。
# Codecov / Coveralls 統合は別 PR で検討(現状は artifact + summary のみ)。
coverage:
name: Coverage (Ubuntu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: llvm-tools-preview
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-dev libxkbcommon-dev libwayland-dev \
libasound2-dev libpulse-dev \
libudev-dev
# cargo-llvm-cov の prebuilt バイナリを GitHub Releases から直接取得する。
# 外部 action に依存しないので Sprint 5-1 / G2 の SHA pin ポリシー違反にならない。
# バージョンは Cargo crates.io 最新を参照して固定する(手動更新)。
- name: Install cargo-llvm-cov (prebuilt binary)
env:
LLVM_COV_VERSION: "0.6.20"
run: |
set -eux
mkdir -p "$HOME/.cargo/bin"
curl -fsSL \
"https://github.com/taiki-e/cargo-llvm-cov/releases/download/v${LLVM_COV_VERSION}/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz" \
| tar -xz -C "$HOME/.cargo/bin"
cargo llvm-cov --version
# session::tests::session_manager_* は PTY fork する重テストで >60 秒ハングするため除外。
# ci.yml の通常テストでも実質これらは別カバーされていない。
- name: Run tests with coverage
run: |
cargo llvm-cov --workspace --lcov --output-path lcov.info \
--ignore-filename-regex 'benches/' \
-- --skip session_manager
- name: Generate summary
run: |
echo "## カバレッジサマリー" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cargo llvm-cov report --summary-only \
--ignore-filename-regex 'benches/' \
>> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-lcov
path: lcov.info
retention-days: 14