forked from osbuild/image-builder-crc
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (132 loc) Β· 3.97 KB
/
tests.yml
File metadata and controls
146 lines (132 loc) Β· 3.97 KB
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
name: Tests
on:
pull_request:
branches:
- "*"
merge_group:
jobs:
lint:
name: "π Checks"
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.12' # also update tools/prepare-source.sh
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3.0.2
- name: Check that source has been prepared
run: |
go env
./tools/prepare-source.sh
if [ -n "$(git status --porcelain)" ]; then
echo
echo "Please include these changes in your branch (only first 5k lines): "
git status -vv | head -n5000
exit "1"
else
exit "0"
fi
- name: check that all distributions are present in the openapi spec
run: |
sudo apt install -y python3-yaml
./tools/check-distributions.py
- name: Build all binaries
run: make build
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.64.6
- name: Run unit tests
run: make unit-tests
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}
speccheck:
name: "π openapi spec check"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
- name: Install openapi-spec-validator
run: pip install openapi-spec-validator
- name: Check v1 spec
run: make check-api-spec
shellcheck:
name: "π Shellcheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@2.0.0
with:
ignore: vendor # We don't want to fix the code in vendored dependencies
version: "v0.10.0"
env:
# don't check /etc/os-release sourcing and allow useless cats to live inside our codebase
# allow seemingly unreachable commands
SHELLCHECK_OPTS: -e SC1091 -e SC2002 -e SC2317
db-test:
name: "π DB check"
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: foobar
POSTGRES_DB: imagebuilder
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/setup-go@v5
with:
go-version: '1.24.12' # also update tools/prepare-source.sh
- env:
MIGRATIONS_DIR: internal/db/migrations
TERN_MIGRATIONS_DIR: internal/db/migrations-tern
PGUSER: postgres
PGPASSWORD: foobar
PGDATABASE: imagebuilder
PGHOST: localhost
PGPORT: 5432
run: |
make dev-prerequisites
./tools/dbtest-entrypoint.sh
kube-linter:
name: "π kube-linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- uses: redhat-actions/oc-installer@v1
- name: Process template
run: |
mkdir processed-templates
oc process -f templates/image-builder.yml \
-p IMAGE_TAG=image_tag \
--local \
-o yaml > processed-templates/image-builder.yml
- uses: stackrox/kube-linter-action@v1.0.5
with:
directory: processed-templates
config: templates/.kube-linter-config.yml
container-test:
name: "π’ container test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- name: Install Prerequisites
run: |
sudo apt update
sudo apt install -y podman
- name: Build and test maintenance container
run: make ubi-maintenance-container-test