forked from flohansen/hsfl-master-ai-cloud-engineering
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (34 loc) · 966 Bytes
/
run-tests-user-service.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
name: Run tests (user-service)
on:
push:
paths:
- 'src/user-service/**'
workflow_dispatch:
jobs:
test:
name: Test user-service
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Install dependencies
working-directory: ./src/user-service
run: go mod tidy
- name: Build
working-directory: ./src/user-service
run: go build -v ./...
- name: Test Go Module
run: |
cd src/user-service
go test ./...
test_exit_code=$? # Capture the exit code of the go test command
if [ $test_exit_code -eq 0 ]; then
echo "Tests passed successfully."
else
echo "Tests failed with exit code $test_exit_code."
exit 1 # Fail the GitHub Actions workflow
fi