forked from flohansen/hsfl-master-ai-cloud-engineering
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (68 loc) · 2.16 KB
/
run-tests-lib-folder.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
name: Run tests (lib folder)
on:
push:
paths:
- 'lib/**'
workflow_dispatch:
jobs:
test:
name: Test lib folder
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 for config
working-directory: ./lib/config
run: go mod tidy
- name: Install dependencies for router
working-directory: ./lib/router
run: go mod tidy
- name: Install dependencies for rpc
working-directory: ./lib/rpc
run: go mod tidy
- name: Build config library
working-directory: ./lib/config
run: go build -v ./...
- name: Build router library
working-directory: ./lib/router
run: go build -v ./...
- name: Build rpc library
working-directory: ./lib/rpc
run: go build -v ./...
- name: Test Go config Module
run: |
cd lib/config
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
- name: Test Go router Module
run: |
cd lib/router
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
- name: Test Go rpc Module
run: |
cd lib/rpc
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