-
Notifications
You must be signed in to change notification settings - Fork 3
141 lines (123 loc) · 3.75 KB
/
Copy pathgo.yml
File metadata and controls
141 lines (123 loc) · 3.75 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: 1.26.x
cache-dependency-path: application/backend/go.sum
- name: Get coverage tool
run: |
cd application/backend
go get golang.org/x/tools/cmd/cover
REF=${{ github.ref }}
IFS='/' read -ra PATHS <<< "$REF"
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
echo $BRANCH_NAME
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
- name: Create failing badge
uses: schneegans/dynamic-badges-action@v1.9.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 7a0933f8cba0bddbcc95c8b850e32663
filename: onlogs_passing__${{ env.BRANCH }}.json
label: Tests
message: Failed
color: red
namedLogo: checkmarx
- name: Vet
run: |
cd application/backend
go vet ./...
- name: Test
run: |
cd application/backend
go test ./... -coverprofile cover.out
go tool cover -func cover.out > covered.txt
- name: Test with the race detector
run: |
cd application/backend
go test -race ./...
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version: 24.x
- name: Frontend tests
run: |
cd application/frontend
npm ci
npm test
- name: Get coverage
run: |
cd application/backend
for word in $(cat covered.txt); do total_percent=$word; done
echo $total_percent
echo "COVERAGE=$total_percent" >> $GITHUB_ENV
- name: Create passing badge
uses: schneegans/dynamic-badges-action@v1.9.0
if: ${{ env.COVERAGE!=null }}
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 7a0933f8cba0bddbcc95c8b850e32663
filename: onlogs_passing__${{ env.BRANCH }}.json
label: Tests
message: Passed
color: green
namedLogo: checkmarx
- name: Create coverage badge
uses: schneegans/dynamic-badges-action@v1.9.0
if: ${{ env.COVERAGE!=null }}
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 7a0933f8cba0bddbcc95c8b850e32663
filename: onlogs_units_coverage__${{ env.BRANCH }}.json
label: Test Coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: go
release:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
issues: write
pull-requests: write
steps:
# semantic-release derives the version from tags, so it needs all of them.
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/setup-node@v7
with:
node-version: 24.x
# Plugins resolve from the repo, not the npx sandbox, so each is named here.
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
npx -y
-p semantic-release@25.0.9
-p @semantic-release/commit-analyzer@13.0.1
-p @semantic-release/release-notes-generator@14.1.1
-p @semantic-release/exec@7.1.0
-p @semantic-release/github@12.0.9
-p conventional-changelog-conventionalcommits@10.2.1
semantic-release