-
Notifications
You must be signed in to change notification settings - Fork 1.6k
54 lines (43 loc) · 1.59 KB
/
linters-checks-and-unit-tests-linux.yml
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
name: PR linters, checks, and unit tests (linux)
# Triggers the workflow on push or pull request events
on: [push, pull_request]
permissions: read-all
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}-${{github.workflow}}
cancel-in-progress: true
jobs:
build:
name: PR linters, checks, and unit tests (linux)
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.*
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run make linters
run: |
make linters
- name: Run make checks
run: |
make checks
# Skip integration tests for `docs`-only changes (only works for PR-based dev workflows like Skaffold's).
# NOTE: grep output is stored in env var with `|| true` as the run command cannot fail or action will fail
- name: Check if only docs changes were made in this PR
run: |
echo ${{ github.event.before }}
echo ${{ github.event.after }}
NON_DOCS_FILES_CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.sha }}| grep -v '^docs/' || true)
echo "NON_DOCS_FILES_CHANGED=${#NON_DOCS_FILES_CHANGED}" >> $GITHUB_ENV # get the char len of diff output (used later)
- name: Run unit tests
if: ${{ env.NON_DOCS_FILES_CHANGED != 0 }}
run: |
make coverage
- name: Run diagnostics tests
if: ${{ env.NON_DOCS_FILES_CHANGED != 0 }}
run: |
make coverage