-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (135 loc) Β· 4.32 KB
/
ci.yml
File metadata and controls
176 lines (135 loc) Β· 4.32 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
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/cache
~/.cargo/registry
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run unit tests
run: cargo test --lib --verbose
- name: Run integration tests
run: cargo test --test integration_tests --verbose
- name: Run all tests
run: cargo test --verbose
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run doctests
run: cargo test --doc
full_test_suite:
name: Full Test Suite
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/cache
~/.cargo/registry
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Git (ensure latest version)
run: |
sudo apt-get update
sudo apt-get install -y git
- name: Run comprehensive test suite
run: |
echo "π§ͺ Running comprehensive test suite..."
# Run all tests with verbose output
echo "π Unit and integration tests..."
cargo test --verbose --all-features
# Run clippy with all features
echo "π Linting with clippy..."
cargo clippy --all-targets --all-features -- -D warnings
# Check code formatting
echo "π¨ Checking code formatting..."
cargo fmt --all -- --check
# Build in release mode
echo "ποΈ Building release version..."
cargo build --release --verbose
# Test binary functionality
echo "β‘ Testing binary functionality..."
./target/release/git-cli --version
./target/release/git-cli --help
# Test in non-interactive mode (if git repo has changes)
echo "π€ Testing non-interactive mode..."
if git status --porcelain | grep -q .; then
echo "Changes detected, testing non-interactive mode..."
# Note: This would normally fail in CI due to no staged changes
# but we can test the argument parsing
./target/release/git-cli --no-interactive --emoji "β¨" --title "test: ci validation" --help || true
fi
echo "β
All tests completed successfully!"
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Generate code coverage
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
security-audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --release --verbose