Update static.yml #13
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: Checks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
Checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
disable-telemetry: true | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go environment | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
cache: true | |
go-version-file: go.mod | |
cache-dependency-path: '**/go.sum' | |
- name: Test | |
run: make test | |
- name: Upload unit test coverage report | |
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ./cover.out | |
flags: controller | |
- name: Upload api test coverage report | |
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ./api_cover.out | |
flags: api | |
# If enterprisecontractpolicy_types.go is updated without a corresponding change to the crd | |
# an uncommitted change can show. | |
- name: Check for uncommitted changes | |
run: | | |
if ! git diff --exit-code -s; then | |
for f in $(git diff --exit-code --name-only); do | |
echo "::error file=$f,line=1,col=1,endColumn=1::File was modified in build" | |
done | |
exit 1 | |
fi |