-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (66 loc) · 1.93 KB
/
test.yml
File metadata and controls
82 lines (66 loc) · 1.93 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
name: Test GitSecure
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Make script executable
run: chmod +x gitsecure
- name: Test help command
run: ./gitsecure --help
- name: Test version command
run: ./gitsecure --version
- name: Test patterns command
run: ./gitsecure patterns
- name: Create test repo
run: |
git config --global user.email "test@test.com"
git config --global user.name "Test"
git init test-repo
cd test-repo
echo "test" > file.txt
git add file.txt
git commit -m "Initial"
- name: Test scan in repo
run: |
cd test-repo
../gitsecure scan || true
- name: Test protect command
run: |
cd test-repo
../gitsecure protect
test -f .gitignore
grep -q "GitSecure" .gitignore
- name: Create test file with fake secret
run: |
cd test-repo
echo 'API_KEY="test_1234567890abcdefghijklmnopqrstuvwxyz"' > config.js
- name: Test check command
run: |
cd test-repo
../gitsecure check config.js || true
- name: Install shellcheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Run shellcheck
continue-on-error: true
run: shellcheck gitsecure
- name: Verify script structure
run: |
grep -q "scan_file()" gitsecure
grep -q "audit_repo()" gitsecure
grep -q "install_hook()" gitsecure
echo "✓ Script structure verified"
- name: All tests passed
run: |
echo "================================"
echo "✓ All tests passed successfully!"
echo "================================"