makes linter happy #2388
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: Build and Test | |
# This workflow will run on master branch and on any pull requests targeting master | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
- converted_to_draft | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Restore binaries from cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./bin | |
key: binary | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
id: go | |
- name: Run Trivy vulnerability scanner in repo mode | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: "fs" | |
ignore-unfixed: true | |
format: "sarif" | |
output: "trivy-results.sarif" | |
severity: "HIGH,CRITICAL,MEDIUM" | |
vuln-type: "os,library" | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: "trivy-results.sarif" | |
- name: Set output variables | |
id: vars | |
run: | | |
IMAGE_TAG=${GITHUB_SHA:0:7} | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT | |
- name: Lint, Test and Build | |
if: github.event.pull_request.draft == false | |
env: | |
GO111MODULE: on | |
DOCKER_BUILD_ARGS: --cache-from=type=gha --cache-to=type=gha,mode=max | |
TAG: ${{ steps.vars.outputs.IMAGE_TAG }} | |
run: | | |
make lint | |
make test | |
TAG=${TAG} make test-e2e | |
if [ -n '${{secrets.REPO_KEY}}' ]; then | |
echo ${{secrets.REPO_KEY}} | docker login --username ${{secrets.REPO_USER}} --password-stdin | |
make publish | |
else | |
echo "there is no docker secret, just build" | |
make build | |
fi | |
- name: Prapare binary cache | |
uses: actions/cache@v4 | |
with: | |
path: ./bin | |
key: binary |