$ name: CI
on: [push, pull_request]
jobs: build: runs-on: ubuntu-latest steps: # 1. Checkout code - uses: actions/checkout@v4 # 2. Set up JDK - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' # 3. Cache dependencies - name: Cache Maven packages uses: actions/cache@v3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} # 4. Lint and format - name: Checkstyle Lint run: mvn checkstyle:check - name: Spotless Format (verify) run: mvn spotless:check # 5. Run tests with coverage - name: Run Unit & Integration Tests run: mvn test jacoco:report # 6. Upload JaCoCo report as artifact - uses: actions/upload-artifact@v3 with: name: code-coverage-report path: target/site/jacoco/index.html
name: CI
on: [push, pull_request]
jobs: build: runs-on: ubuntu-latest steps: # 1. Checkout code - uses: actions/checkout@v4 # 2. Set up JDK - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' # 3. Cache dependencies - name: Cache Maven packages uses: actions/cache@v3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} # 4. Lint and format - name: Checkstyle Lint run: mvn checkstyle:check - name: Spotless Format (verify) run: mvn spotless:check # 5. Run tests with coverage - name: Run Unit & Integration Tests run: mvn test jacoco:report # 6. Upload JaCoCo report as artifact - uses: actions/upload-artifact@v3 with: name: code-coverage-report path: target/site/jacoco/index.html
name: CI
on: [push, pull_request]
jobs: build: runs-on: ubuntu-latest steps: # 1. Checkout code - uses: actions/checkout@v4 # 2. Set up JDK - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' # 3. Cache dependencies - name: Cache Maven packages uses: actions/cache@v3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} # 4. Lint and format - name: Checkstyle Lint run: mvn checkstyle:check - name: Spotless Format (verify) run: mvn spotless:check # 5. Run tests with coverage - name: Run Unit & Integration Tests run: mvn test jacoco:report # 6. Upload JaCoCo report as artifact - uses: actions/upload-artifact@v3 with: name: code-coverage-report path: target/site/jacoco/index.html
name: CD
on: push: branches: [ main ] tags: [ 'v*' ]
jobs: deploy: runs-on: ubuntu-latest environment: name: ${{ github.ref_name == 'main' && 'staging' || 'production' }} steps: - uses: actions/checkout@v4 - uses: -weight: 500;">docker/setup-buildx-action@v3 - name: 'Build Docker image' run: -weight: 500;">docker build -t ghcr.io/org/repo:${GITHUB_SHA} . - name: 'Login to ghcr.io' uses: -weight: 500;">docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'Push Docker image' run: -weight: 500;">docker push ghcr.io/org/repo:${GITHUB_SHA} - name: 'Deploy to ECS/Kubernetes/etc.' run: ./scripts/deploy.sh ${{ github.ref_name }} env: DEPLOY_ENV: ${{ github.ref_name == 'main' && 'staging' || 'production' }} # Set other secrets as needed
name: CD
on: push: branches: [ main ] tags: [ 'v*' ]
jobs: deploy: runs-on: ubuntu-latest environment: name: ${{ github.ref_name == 'main' && 'staging' || 'production' }} steps: - uses: actions/checkout@v4 - uses: -weight: 500;">docker/setup-buildx-action@v3 - name: 'Build Docker image' run: -weight: 500;">docker build -t ghcr.io/org/repo:${GITHUB_SHA} . - name: 'Login to ghcr.io' uses: -weight: 500;">docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'Push Docker image' run: -weight: 500;">docker push ghcr.io/org/repo:${GITHUB_SHA} - name: 'Deploy to ECS/Kubernetes/etc.' run: ./scripts/deploy.sh ${{ github.ref_name }} env: DEPLOY_ENV: ${{ github.ref_name == 'main' && 'staging' || 'production' }} # Set other secrets as needed
name: CD
on: push: branches: [ main ] tags: [ 'v*' ]
jobs: deploy: runs-on: ubuntu-latest environment: name: ${{ github.ref_name == 'main' && 'staging' || 'production' }} steps: - uses: actions/checkout@v4 - uses: -weight: 500;">docker/setup-buildx-action@v3 - name: 'Build Docker image' run: -weight: 500;">docker build -t ghcr.io/org/repo:${GITHUB_SHA} . - name: 'Login to ghcr.io' uses: -weight: 500;">docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'Push Docker image' run: -weight: 500;">docker push ghcr.io/org/repo:${GITHUB_SHA} - name: 'Deploy to ECS/Kubernetes/etc.' run: ./scripts/deploy.sh ${{ github.ref_name }} env: DEPLOY_ENV: ${{ github.ref_name == 'main' && 'staging' || 'production' }} # Set other secrets as needed
- name: SonarQube Scan uses: SonarSource/sonarcloud-github-action@master with: organization: my-org projectKey: my-org_my-project token: ${{ secrets.SONAR_TOKEN }}
- name: SonarQube Scan uses: SonarSource/sonarcloud-github-action@master with: organization: my-org projectKey: my-org_my-project token: ${{ secrets.SONAR_TOKEN }}
- name: SonarQube Scan uses: SonarSource/sonarcloud-github-action@master with: organization: my-org projectKey: my-org_my-project token: ${{ secrets.SONAR_TOKEN }}
- name: Initialize CodeQL uses: github/codeql-action/init@v4 with: languages: java
- name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4
- name: Initialize CodeQL uses: github/codeql-action/init@v4 with: languages: java
- name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4
- name: Initialize CodeQL uses: github/codeql-action/init@v4 with: languages: java
- name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4
- name: Scan IaC with KICS uses: checkmarx/kics-github-action@v2.1.20 with: path: './infra/' fail_on: 'high'
- name: Scan IaC with KICS uses: checkmarx/kics-github-action@v2.1.20 with: path: './infra/' fail_on: 'high'
- name: Scan IaC with KICS uses: checkmarx/kics-github-action@v2.1.20 with: path: './infra/' fail_on: 'high'
- name: Run Trivy image scan uses: aquasecurity/trivy-action@v0.36.0 with: image-ref: ghcr.io/org/repo:${GITHUB_SHA} format: 'table' exit-code: '1' # Fail build if vulnerabilities found
- name: Run Trivy image scan uses: aquasecurity/trivy-action@v0.36.0 with: image-ref: ghcr.io/org/repo:${GITHUB_SHA} format: 'table' exit-code: '1' # Fail build if vulnerabilities found
- name: Run Trivy image scan uses: aquasecurity/trivy-action@v0.36.0 with: image-ref: ghcr.io/org/repo:${GITHUB_SHA} format: 'table' exit-code: '1' # Fail build if vulnerabilities found
- name: Generate OpenAPI Docs run: mvn springdoc-openapi:generate
- name: Publish Docs to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./target/generated-docs publish_branch: gh-pages
- name: Generate OpenAPI Docs run: mvn springdoc-openapi:generate
- name: Publish Docs to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./target/generated-docs publish_branch: gh-pages
- name: Generate OpenAPI Docs run: mvn springdoc-openapi:generate
- name: Publish Docs to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./target/generated-docs publish_branch: gh-pages
- name: Notify Slack uses: slackapi/slack-github-action@v3.0.2 with: webhook: ${{ secrets.SLACK_WEBHOOK_URL }} webhook-type: incoming-webhook payload: | { "text": "✅ Deployment to ${{ env.DEPLOY_ENV }} succeeded for commit ${{ github.sha }}" }
- name: Notify Slack uses: slackapi/slack-github-action@v3.0.2 with: webhook: ${{ secrets.SLACK_WEBHOOK_URL }} webhook-type: incoming-webhook payload: | { "text": "✅ Deployment to ${{ env.DEPLOY_ENV }} succeeded for commit ${{ github.sha }}" }
- name: Notify Slack uses: slackapi/slack-github-action@v3.0.2 with: webhook: ${{ secrets.SLACK_WEBHOOK_URL }} webhook-type: incoming-webhook payload: | { "text": "✅ Deployment to ${{ env.DEPLOY_ENV }} succeeded for commit ${{ github.sha }}" }