-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.04 KB
/
tests.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
name: Go Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Go
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
# Step 3: Install dependencies
- name: Install dependencies
run: go mod tidy
# Step 4: Run tests
- name: Run tests
run: go test ./... --short -v
# Step 5: Upload test results (optional)
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test-results
path: '**/test-report.xml'
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest
services:
apicurio:
image: apicurio/apicurio-registry:3.0.5
ports:
- 9080:8080
options: >-
--env APICURIO_REST_MUTABILITY_ARTIFACT_VERSION_CONTENT_ENABLED=true
--env APICURIO_REST_DELETION_ARTIFACT_ENABLED=true
--env APICURIO_REST_DELETION_ARTIFACT_VERSION_ENABLED=true
--env APICURIO_REST_DELETION_GROUP_ENABLED=true
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Set up Go environment
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
# Install dependencies
- name: Install dependencies
run: go mod tidy
# Wait for Apicurio Registry to start
- name: Wait for Apicurio Registry
run: |
for i in {1..30}; do
if curl -s http://localhost:9080/health || [ $i -eq 30 ]; then
break
fi
echo "Waiting for Apicurio Registry to be ready..."
sleep 2
done
# Run integration tests
- name: Run integration tests
run: go test ./... -run Integration -v