-
Notifications
You must be signed in to change notification settings - Fork 27
181 lines (175 loc) · 5.84 KB
/
content-sources-actions.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: build-test
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
openapidiff:
name: Openapi diff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.23"
- run: |
go get -u github.com/swaggo/swag/cmd/swag
- run: |
make openapi
- run: |
git diff --exit-code api/openapi.json
openapivalidate:
name: openapi validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: openapi-generators/openapitools-generator-action@v1
with:
generator: python
openapi-file: api/openapi.json
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.23"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61.0
skip-go-installation: true
args: --timeout=5m
checkmigrations:
name: Check db migrations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: tj-actions/changed-files@v41
id: files
- run: |
#!/bin/bash
migrations_latest=$(cat db/migrations.latest)
num_files_added=${{ steps.files.outputs.added_files_count }}
if [ "$num_files_added" -gt 0 ]; then
new_migrations_added=$(echo "${{ steps.files.outputs.added_files }}" | grep 'db/migrations' || true)
if [ -n "$new_migrations_added" ]; then
if echo "$new_migrations_added" | grep -q "$migrations_latest"; then
echo "OK: Latest migration content (db/migrations.latest) reflects the timestamp of the latest migrations added."
else
echo "Error: Latest migration content (db/migrations.latest) does NOT reflect the timestamp of the latest migrations added."
echo "New migration files added: $new_migrations_added"
echo "In db/migration.latest: $migrations_latest"
exit 1
fi
else
echo "OK: No new migration files added."
fi
else
echo "OK: No new files added."
fi
gotest:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5433:5432
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.23"
- name: unit tests
run: |
make get-deps ${PWD}/release/dbmigrate db-migrate-up test-unit
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5433
DATABASE_USER: postgres
DATABASE_NAME: postgres
DATABASE_PASSWORD: postgres
CLIENTS_PULP_SERVER: http://localhost:8080
CLIENTS_PULP_USERNAME: admin
CLIENTS_PULP_PASSWORD: password
CLIENTS_CANDLEPIN_SERVER: http://localhost:8181/candlepin
CLIENTS_CANDLEPIN_USERNAME: admin
CLIENTS_CANDLEPIN_PASSWORD: admin
CLIENTS_CANDLEPIN_DEVEL_ORG: true
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 pulp.content" | sudo tee -a /etc/hosts
- name: start pulp
uses: isbang/[email protected]
with:
compose-file: docker-compose.yml
cwd: ./compose_files/pulp/
down-flags: --volumes
- name: Wait for pulp
run: |
docker run --network=host --rm -v ${PWD}:/local curlimages/curl \
curl --retry-all-errors --fail --retry-delay 10 --retry 32 --retry-max-time 240 http://localhost:8080/api/pulp/default/api/v3/repositories/rpm/rpm/ -u admin:password
sleep 30
- name: start candlepin
uses: isbang/[email protected]
with:
compose-file: docker-compose.yml
cwd: ./deployments/
services: |
candlepin
down-flags: --volumes
env:
CONTENT_DATABASE_PORT: 5434
- name: Wait for candlepin
run: |
docker run --network=host --rm -v ${PWD}:/local curlimages/curl \
curl --retry-all-errors --fail --retry-delay 10 --retry 32 --retry-max-time 240 http://localhost:8181/candlepin/owners -u admin:admin
sleep 30
- name: integration tests
run: |
go run cmd/candlepin/main.go init
make test-integration
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5433
DATABASE_USER: postgres
DATABASE_NAME: postgres
DATABASE_PASSWORD: postgres
CLIENTS_PULP_SERVER: http://localhost:8080
CLIENTS_PULP_USERNAME: admin
CLIENTS_PULP_PASSWORD: password
CLIENTS_PULP_DATABASE_HOST: localhost
CLIENTS_PULP_DATABASE_PORT: 5432
CLIENTS_PULP_DATABASE_USER: pulp
CLIENTS_PULP_DATABASE_PASSWORD: password
CLIENTS_PULP_DATABASE_NAME: pulp
CLIENTS_CANDLEPIN_SERVER: http://localhost:8181/candlepin
CLIENTS_CANDLEPIN_USERNAME: admin
CLIENTS_CANDLEPIN_PASSWORD: admin
CLIENTS_CANDLEPIN_DEVEL_ORG: true
- name: db migration tests
run: |
make test-db-migrations
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5433
DATABASE_USER: postgres
DATABASE_NAME: postgres
DATABASE_PASSWORD: postgres
CLIENTS_PULP_SERVER: http://localhost:8080
CLIENTS_PULP_USERNAME: admin
CLIENTS_PULP_PASSWORD: password