-
Notifications
You must be signed in to change notification settings - Fork 15
161 lines (138 loc) · 3.96 KB
/
test.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Test
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
paths:
- .github/workflows/test.yml
- cmd/**/*.go
- testdata/**/*
- makefile
- .golangci.yml
- go.mod
- go.sum
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- uses: golangci/golangci-lint-action@v3
with:
# must be specified without patch version
version: v1.51
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- name: Check formatting
run: |
make format-check
vulnerability-check:
name: "Vulnerability check"
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run vulnerability check
run: |
echo "$(govulncheck ./... 2>&1 | tee vulnerability_report.out)"
test -n "$(grep 'No vulnerabilities found.' vulnerability_report.out)"
# Make sure local_repository.pidx is linted against PackIndex.xsd
xmllint:
name: Xmllint
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install libxml2-utils
- name: Check if local_repository.pidx is valid
run: |
make test-xmllint-localrepository
test-amd64:
strategy:
matrix:
# Tests on Mac are currently broken
goos: [windows, linux, darwin]
include:
- goos: windows
runs-on: windows-latest
- goos: linux
runs-on: ubuntu-latest
- goos: darwin
runs-on: macos-latest
name: "${{ matrix.goos }} | amd64"
runs-on: ${{ matrix.runs-on }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- name: Unit testing
run: |
make coverage-check
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: always()
with:
files: cover.out
os: ${{ matrix.goos }}
fail_ci_if_error: true
functionalities: fix
test-linux-arm64:
name: "linux | arm64"
runs-on: ubuntu-latest
steps:
- name: Unit testing
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu_latest
env: |
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
install: |
apt-get update -qq -y
apt-get install -qq -y software-properties-common git make
add-apt-repository -y ppa:longsleep/golang-backports
apt-get update -qq -y
apt-get install -qq -y golang-1.20
run: |
export PATH=$PATH:/usr/lib/go-1.20/bin
git clone --depth 1 ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
cd cpackget
git fetch --depth 1 origin ${GITHUB_REF}
git checkout FETCH_HEAD
make coverage-check