rewrite #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 | |
on: | |
push: | |
branches: [ main, development ] | |
pull_request: | |
branches: [ main, development ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Install dependencies | |
run: | | |
go install golang.org/x/lint/golint@latest | |
go install github.com/securego/gosec/v2/cmd/gosec@latest | |
- name: Build | |
run: make build | |
- name: Lint | |
run: make lint | |
- name: Test with coverage | |
run: make test-coverage | |
- name: Security Scan | |
run: make security-scan | |
- name: Upload coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: goapp/coverage.html | |
if: github.ref == 'refs/heads/development' && github.event_name == 'push' | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: goapp | |
path: goapp/build/goapp | |
if: github.ref == 'refs/heads/development' && github.event_name == 'push' | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
steps: | |
- name: Deploy to production | |
run: echo "Deploy to production server" | |
# Add your deployment steps here |