Skip to content

Commit 3a63c2f

Browse files
authored
Migrate Go petstore tests from circleci to github workflow (#21997)
* migrate go tests from circleci to github workflow * update samples * update samples * update workflow * update samples * update samples * update test * update tests * update tests * fix * fix * update host table * update tests * update spec * new spec
1 parent 73c8728 commit 3a63c2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2126
-2687
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Samples Go Clients (Petstore)
2+
3+
on:
4+
push:
5+
paths:
6+
- samples/client/petstore/go/**
7+
- samples/openapi3/client/petstore/go/**
8+
pull_request:
9+
paths:
10+
- samples/client/petstore/go/**
11+
- samples/openapi3/client/petstore/go/**
12+
13+
jobs:
14+
build:
15+
name: Build Go
16+
runs-on: ubuntu-latest
17+
services:
18+
petstore-api:
19+
image: swaggerapi/petstore
20+
ports:
21+
- 80:8080
22+
env:
23+
SWAGGER_HOST: http://petstore.swagger.io
24+
SWAGGER_BASE_PATH: /v2
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
sample:
29+
- samples/client/petstore/go/
30+
- samples/openapi3/client/petstore/go/
31+
steps:
32+
- uses: actions/checkout@v5
33+
- name: Add hosts to /etc/hosts
34+
run: |
35+
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
36+
- uses: actions/setup-go@v6
37+
- run: go version
38+
- name: Install Dependencies
39+
working-directory: ${{ matrix.sample }}
40+
run: |
41+
go mod tidy
42+
- name: Run test
43+
working-directory: ${{ matrix.sample }}
44+
run: go test -mod=mod -v
45+

.github/workflows/samples-go-client.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ on:
66
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/**'
77
- 'samples/openapi3/client/petstore/go-petstore-withXml/**'
88
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/**
9+
- samples/client/others/go/allof_multiple_ref_and_discriminator/**
10+
- samples/client/others/go/oneof-anyof-required/**
11+
- samples/client/others/go/oneof-discriminator-lookup/**
912
pull_request:
1013
paths:
1114
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/**'
1215
- 'samples/openapi3/client/petstore/go-petstore-withXml/**'
1316
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/**
14-
17+
- samples/client/others/go/allof_multiple_ref_and_discriminator/**
18+
- samples/client/others/go/oneof-anyof-required/**
19+
- samples/client/others/go/oneof-discriminator-lookup/**
1520
jobs:
1621
build:
1722
name: Build Go
@@ -23,6 +28,9 @@ jobs:
2328
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/'
2429
- 'samples/openapi3/client/petstore/go-petstore-withXml/'
2530
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/
31+
- samples/client/others/go/allof_multiple_ref_and_discriminator/
32+
- samples/client/others/go/oneof-anyof-required/
33+
- samples/client/others/go/oneof-discriminator-lookup/
2634
steps:
2735
- uses: actions/checkout@v5
2836
- uses: actions/setup-go@v6

CI/circle_parallel.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
5656
sudo ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true
5757
source ~/.cpprc # activate cpp environment variables
5858

59-
# run go integration tests
60-
(cd samples/client/petstore/go && mvn integration-test)
61-
(cd samples/openapi3/client/petstore/go && mvn integration-test)
62-
(cd samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false && mvn integration-test)
63-
(cd samples/client/others/go/allof_multiple_ref_and_discriminator && mvn integration-test)
6459
(cd samples/client/petstore/cpp-restsdk/client && mvn integration-test)
6560

6661
elif [ "$NODE_INDEX" = "3" ]; then

bin/configs/go-petstore-oas2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
generatorName: go
22
outputDir: samples/client/petstore/go/go-petstore
3-
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
3+
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-localhost.yaml
44
templateDir: modules/openapi-generator/src/main/resources/go
55
additionalProperties:
66
packageName: petstore

0 commit comments

Comments
 (0)