generated from d2iq-archive/golang-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 11
135 lines (116 loc) · 3.2 KB
/
checks.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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Copyright 2021 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: checks
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
jobs:
unit-test:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
permissions:
checks: write
pull-requests: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Run unit tests
run: devbox run -- make test
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: "Unit test results"
files: |
junit-report.xml
e2e-test:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
permissions:
checks: write
pull-requests: write
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Run e2e tests
run: devbox run -- make e2e-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TMPDIR: ${{ runner.temp }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: "e2e test results"
files: |
junit-e2e.xml
lint:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Export golang and golangci-lint versions
run: |
echo "GOLANGCI_LINT_VERSION=v$(devbox run -- golangci-lint version --format short)" >>$GITHUB_ENV
echo "GO_VERSION=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>$GITHUB_ENV
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
fail_on_error: true
reporter: github-pr-review
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }}
go_version: ${{ env.GO_VERSION }}
pre-commit:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Set up pre-commit cache
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: devbox run -- make pre-commit
env:
SKIP: no-commit-to-branch,golangci-lint