-
Notifications
You must be signed in to change notification settings - Fork 3
121 lines (102 loc) · 3.13 KB
/
ci.yml
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
name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up shellcheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Run shellcheck
run: |
shellcheck ssl_manager.sh
shellcheck auth_methods.sh
shellcheck tests/*.sh
- name: Run shfmt
run: |
curl -sS https://webinstall.dev/shfmt | bash
shfmt -d .
test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up test environment
run: |
sudo apt-get update
sudo apt-get install -y sshpass openssh-client
- name: Run unit tests
run: |
chmod +x tests/test_framework.sh
chmod +x tests/test_server_setup.sh
chmod +x tests/test_service_management.sh
chmod +x tests/test_authentication.sh
./tests/test_server_setup.sh
./tests/test_service_management.sh
./tests/test_authentication.sh
- name: Run integration tests
run: |
chmod +x tests/integration_test.sh
./tests/integration_test.sh
- name: Generate test report
if: always()
run: |
echo "# Test Results" > test-report.md
echo "## Unit Tests" >> test-report.md
cat tests/test-output.log >> test-report.md
echo "## Integration Tests" >> test-report.md
cat tests/integration-output.log >> test-report.md
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-report.md
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release v${{ github.run_number }}
body: |
Automated release for commit ${{ github.sha }}
Changes in this release:
- Automated deployment from main branch
- All tests passed successfully
- Code quality verified by shellcheck
draft: false
prerelease: false
- name: Package scripts
run: |
tar -czf nadoo-server-management.tar.gz \
ssl_manager.sh \
auth_methods.sh \
README.md \
config/
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nadoo-server-management.tar.gz
asset_name: nadoo-server-management.tar.gz
asset_content_type: application/gzip
- name: Deploy Documentation
run: |
echo "Deploying documentation..."
# Add documentation deployment steps here