forked from kyma-project/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (85 loc) · 2.8 KB
/
call-unit-lint-head-ref.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# 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 & lint
on:
workflow_call:
jobs:
changed-files:
outputs:
any_modified: ${{ steps.changed-files.outputs.any_modified }}
name: Check whether unit test & lint should run based on the changed files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- 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
lint:
name: Lint
runs-on: ubuntu-latest
needs: [ changed-files ]
if: ${{ needs.changed-files.outputs.any_modified }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
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@ec5d18412c0aeab7936cb16880d708ba2a64e1ae #v6.2.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 }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
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 }} \
./tests/integration/scripts/code-coverage-guard.sh
run-unit-tests-experimental:
name: Run unit tests with experimental build tag
if: ${{ needs.changed-files.outputs.any_modified }}
needs: [ changed-files ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make test-experimental-tag