Renamed repository to NADOO-Servermanager #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 manage_servers.sh | |
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 \ | |
manage_servers.sh \ | |
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 |