Skip to content

Commit 87ef04d

Browse files
authored
ci(backend): Add gotest CI (#64)
1 parent e169c74 commit 87ef04d

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/Gotest.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Gotest
2+
on:
3+
workflow_call:
4+
inputs:
5+
subrepo:
6+
required: true
7+
type: string
8+
jobs:
9+
go-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v5
13+
with:
14+
fetch-depth: 0
15+
16+
- uses: actions/setup-go@v6
17+
with:
18+
go-version-file: ./${{ inputs.subrepo }}/go.mod
19+
cache-dependency-path: ./${{ inputs.subrepo }}/go.sum
20+
21+
# We could do this with service containers, but then we wouldn't be able to only run it when we're testing the backend.
22+
- uses: ikalnytskyi/action-setup-postgres@10ab8a56cc77b4823c2bfa57b1d4dd5605ef0481 # v7
23+
if: ${{ inputs.subrepo }} == 'backend'
24+
with:
25+
username: admin
26+
password: admin
27+
database: vote
28+
ssl: false
29+
30+
- name: Run go tests
31+
working-directory: ./${{ inputs.subrepo }}
32+
run: go test github.com/${{ github.repository}}/${{ inputs.subrepo }}/...

.github/workflows/Handoff.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ jobs:
5252
with:
5353
subrepo: backend
5454

55+
backend-gotest:
56+
needs: handoff
57+
if: contains(needs.handoff.outputs.category, 'Go') && contains(needs.handoff.outputs.directory, 'backend')
58+
uses: ./.github/workflows/Gotest.yml
59+
with:
60+
subrepo: backend
61+
5562
web-tsc:
5663
needs: handoff
5764
uses: ./.github/workflows/Tsc.yml

0 commit comments

Comments
 (0)