fix: dependabot add on schedule #63
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 master | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
jobs: | |
initial: | |
name: Initializing | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
go-version: ['1.18.x', '1.19', '1.20'] | |
platform: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Go modules Cache | |
uses: actions/cache@v2 | |
id: go-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go- | |
- if: steps.go-cache.outputs.cache-hit != 'true' | |
run: go mod download | |
- name: Test | |
working-directory: ./app/cmd/main | |
run: go test -race ./... | |
- name: Build | |
working-directory: ./app/cmd/main | |
run: go build -v -o app-${{ matrix.go-version }} | |
- name: Upload Build results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Go-results-${{ matrix.go-version }} | |
path: ./app/cmd/main/app-${{ matrix.go-version }} | |
docker-check-vulnerabilities: | |
runs-on: ubuntu-latest | |
needs: initial | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkov Dockerfile Scan | |
uses: bridgecrewio/[email protected] | |
with: | |
directory: container-image-scannig | |
framework: dockerfile | |
- name: Upload SARIF file | |
uses: github/codeql-action/upload-sarif@v2 | |
# Results are generated only on a success or failure | |
# this is required since GitHub by default won't run the next step | |
# when the previous one has failed. Security checks that do not pass will 'fail'. | |
# An alternative is to add `continue-on-error: true` to the previous step | |
# Or 'soft_fail: true' to checkov. | |
if: success() || failure() | |
with: | |
sarif_file: results.sarif | |
docker: | |
runs-on: ubuntu-latest | |
needs: docker-check-vulnerabilities | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download a single artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: Go-results-1.19 | |
- shell: bash | |
run: | | |
mv app-1.19 albums | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: arturmon/albums:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |