-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (77 loc) · 2.35 KB
/
test.yml
File metadata and controls
95 lines (77 loc) · 2.35 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
name: Test GitBackup
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 gitbackup
- name: Test help command
run: ./gitbackup --help
- name: Test version command
run: ./gitbackup --version
- name: Create test git repository
run: |
mkdir -p /tmp/test-repos/project1
cd /tmp/test-repos/project1
git config --global user.email "test@test.com"
git config --global user.name "Test User"
git init
echo "test content" > file.txt
git add .
git commit -m "Initial commit"
- name: Test scan command
run: |
./gitbackup scan /tmp/test-repos
echo "✓ Scan completed"
- name: Test list command
run: |
./gitbackup list
echo "✓ List completed"
- name: Test backup command
run: |
mkdir -p /tmp/backup-test
./gitbackup backup -d /tmp/backup-test
echo "✓ Backup completed"
- name: Test compressed backup
run: |
mkdir -p /tmp/backup-compressed
./gitbackup backup -d /tmp/backup-compressed --compress
echo "✓ Compressed backup completed"
- name: Verify backup was created
run: |
ls -la /tmp/backup-compressed/
echo "✓ Backup files verified"
- name: Test status command
run: |
./gitbackup status
echo "✓ Status check completed"
- name: Test log command
run: |
./gitbackup log || true
echo "✓ Log command completed"
- name: Install shellcheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Run shellcheck
continue-on-error: true
run: shellcheck gitbackup
- name: Verify script structure
run: |
grep -q "scan_repos()" gitbackup
grep -q "list_repos()" gitbackup
grep -q "backup_repo()" gitbackup
echo "✓ Script structure verified"
- name: All tests passed
run: |
echo "================================"
echo "✓ All tests passed successfully!"
echo "================================"