@@ -2,9 +2,8 @@ name: Go Checks
22
33on :
44 pull_request :
5- branches : [main, develop]
65 push :
7- branches : [main, develop ]
6+ branches : [" main" ]
87 workflow_dispatch :
98
109permissions :
@@ -15,88 +14,19 @@ concurrency:
1514 cancel-in-progress : true
1615
1716jobs :
18- go-check-all :
19- name : go-check / All
20- runs-on : ubuntu-latest
21- services :
22- mysql :
23- image : mysql:8.0
24- env :
25- MYSQL_ROOT_PASSWORD : root
26- MYSQL_DATABASE : singularity
27- MYSQL_USER : singularity
28- MYSQL_PASSWORD : singularity
29- ports :
30- - 3306:3306
31- options : >-
32- --health-cmd="mysqladmin ping"
33- --health-interval=10s
34- --health-timeout=5s
35- --health-retries=3
36-
37- postgres :
38- image : postgres:15
39- env :
40- POSTGRES_USER : singularity
41- POSTGRES_PASSWORD : singularity
42- POSTGRES_DB : singularity
43- ports :
44- - 5432:5432
45- options : >-
46- --health-cmd pg_isready
47- --health-interval 10s
48- --health-timeout 5s
49- --health-retries 5
50-
51- steps :
52- - uses : actions/checkout@v3
53-
54- - name : Set up Go
55- uses : actions/setup-go@v4
56- with :
57- go-version : " 1.21.x"
58-
59- - name : Wait for PostgreSQL
60- run : |
61- echo "Waiting for PostgreSQL..."
62- for i in {1..10}; do
63- if PGPASSWORD=singularity psql -h localhost -U singularity -d singularity -c "SELECT 1" > /dev/null 2>&1; then
64- echo "Postgres is ready!"
65- break
66- fi
67- sleep 3
68- done
69-
70- - name : Verify MySQL connection
71- run : mysql -h127.0.0.1 -P3306 -usingularity -psingularity -e "SELECT VERSION();"
72-
73- - name : Verify PostgreSQL connection
74- run : PGPASSWORD=singularity psql -h localhost -U singularity -d singularity -c "SELECT version();"
75-
76- - name : Ensure swagger directories exist
77- run : mkdir -p client/swagger/client
78-
79- - name : Install swagger tools
80- run : go install github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5
81-
82- - name : Generate code
83- run : go generate ./client/swagger/...
84-
85- - name : Build
86- run : go build ./...
87-
88- - name : Run tests
89- run : go test -v ./...
17+ go-check :
18+ uses : ipdxco/unified-github-workflows/.github/workflows/go-check.yml@v1.0.22
9019
9120 staticcheck :
9221 runs-on : ubuntu-latest
9322 steps :
94- - uses : actions/checkout@v3
23+ - name : Checkout code
24+ uses : actions/checkout@v3
9525
9626 - name : Set up Go
9727 uses : actions/setup-go@v4
9828 with :
99- go-version : " 1.21.x "
29+ go-version : " 1.21"
10030
10131 - name : Install staticcheck
10232 run : go install honnef.co/go/tools/cmd/staticcheck@latest
0 commit comments