Skip to content

add needs-triage workflow #909

add needs-triage workflow

add needs-triage workflow #909

Workflow file for this run

name: CI
# Triggers the workflow on push or pull request events but only for the main branch
on:
push:
branches: [main]
pull_request:
branches: [main]
# Only allow one job of this action to be ran at a time
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go environment
uses: actions/setup-go@v2.1.3
with:
# The Go version to download (if necessary) and use. Supports semver spec and ranges.
go-version: 1.18
- name: Generate Go sources, CRDs and schemas
run: |
bash ./docker-run.sh ./build.sh
if [[ ! -z $(git status -s) ]]
then
echo 'Command `bash ./docker-run.sh ./build.sh` did introduce changes, which should not be the case if it had been run as part of the PR. Please run it locally and check in the results as part of your PR.'
git --no-pager diff
exit 1
fi
- name: Validate samples against schemas
run: bash ./docker-run.sh ./validate-samples.sh
- name: Run GO tests
run: go test -coverprofile cover.out -v ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.1.0
- name: Check typescript model generation
run: bash ./build/typescript-model/generate.sh
- name: Check GO mod state
run: |
go mod tidy
go mod vendor
git diff --exit-code || { echo 'Go mod is not clean. Execute "go mod tidy && go mod vendor" locally and commit changes to fix an issue'; exit 1; }
- name: Check GO format
run: |
go fmt -x ./...
git diff --exit-code || { echo 'Go sources need to be formatted. Execute "go fmt -x ./..." locally and commit changes to fix an issue'; exit 1; }
- name: Check Generator GO mod state
working-directory: generator
run: |
go mod tidy
go mod vendor
git diff --exit-code || { echo 'Go mod is not clean. Execute "go mod tidy && go mod vendor" locally in the 'generator' folder and commit changes to fix an issue'; exit 1; }
- name: Check Generator GO format
working-directory: generator
run: |
go fmt -x ./...
git diff --exit-code || { echo 'Go sources need to be formatted. Execute "go fmt -x ./..." locally in the 'generator' folder and commit changes to fix an issue'; exit 1; }
- name: Run Gosec Security Scanner
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go install github.com/securego/gosec/v2/cmd/gosec@v2.14.0
bash ./run_gosec.sh
if [[ $? != 0 ]]
then
echo "gosec scanner failed to run "
exit 1
fi
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: gosec.sarif