-
Notifications
You must be signed in to change notification settings - Fork 2
124 lines (99 loc) · 3.63 KB
/
Copy pathci.yml
File metadata and controls
124 lines (99 loc) · 3.63 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
name: Lint Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python 3.11
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39
with:
version: "latest"
- name: Install dependencies
run: uv sync --dev
- name: Check code formatting with black
run: uv run black --check --diff src/ tests/
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python 3.11
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39
with:
version: "latest"
- name: Install dependencies
run: uv sync --dev
- name: Run tests
run: uv run python -m pytest tests/ -v
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python 3.11
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39
with:
version: "latest"
- name: Install dependencies
run: uv sync --dev
- name: Install the package
run: uv run pip install -e .
- name: Test CLI help command
run: uv run validate-secrets --help
- name: Test list validators command
run: uv run validate-secrets list-validators
- name: Test file validation with sample data
run: |
# Test with CSV file
uv run validate-secrets check-file tests/samples/test_secrets.csv --file-format csv --format table
# Test with JSON file
uv run validate-secrets check-file tests/samples/test_secrets.json --file-format json --format json
# Test with text file
uv run validate-secrets check-file tests/samples/test_secrets.txt --file-format text google_api_key --format table
- name: Test single secret validation
run: |
# Test with a sample Google API key format (invalid but proper format)
export TEST_KEY=$(head -n 1 tests/samples/test_google_keys.txt)
uv run validate-secrets validate "$TEST_KEY" google_api_key
ci-success:
name: CI Success
runs-on: ubuntu-latest
needs: [lint, test, integration-test]
if: always()
steps:
- name: Check all jobs status
run: |
echo "Lint: ${{ needs.lint.result }}"
echo "Test: ${{ needs.test.result }}"
echo "Integration Test: ${{ needs.integration-test.result }}"
if [[ "${{ needs.lint.result }}" != "success" ||
"${{ needs.test.result }}" != "success" ||
"${{ needs.integration-test.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
echo "All CI jobs completed successfully!"