-
Notifications
You must be signed in to change notification settings - Fork 26
68 lines (65 loc) · 2.16 KB
/
call-unit-lint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Jobs defined in this file are responsible for things that do not require container image
# but still relevant to the codebase such as unit tests, linting etc
name: Pull Request unit, integration & lint
on:
workflow_call:
jobs:
changed-files:
name: Check changed files
runs-on: ubuntu-latest
outputs:
any_modified: ${{ steps.changed-files.outputs.any_modified }}
steps:
- uses: actions/checkout@v4
- uses: tj-actions/changed-files@e9772d140489982e0e3704fea5ee93d536f1e275
id: changed-files
with:
files_ignore: |
docs/**
**/*.md
tests/performance/**
OWNERS
CODEOWNERS
sec-scanners-config.yaml
.reuse/**
external-images.yaml
- name: List all changed files
run: echo '${{ steps.changed-files.outputs.all_changed_files }}' >> $GITHUB_STEP_SUMMARY
lint:
name: Golang lint check
runs-on: ubuntu-latest
needs: [ changed-files ]
if: needs.changed-files.outputs.any_modified == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: false # We need to disable caching here, since this is handled by the golangci-lint action
- name: golangci-lint
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 #v6.1.0
with:
version: 'latest'
args: --timeout=10m --verbose
run-unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
needs: [ changed-files ]
if: needs.changed-files.outputs.any_modified == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PULL_PULL_SHA=${{ github.event.pull_request.head.sha}} \
PULL_BASE_SHA=${{ github.event.pull_request.base.sha}} \
PULL_NUMBER=${{ github.event.number }} \
./hack/ci/code-coverage-guard.sh