Skip to content

Commit 9e880aa

Browse files
fix: disable race check for go tests and cicd improvements
1 parent 2d2aa11 commit 9e880aa

File tree

8 files changed

+52
-33
lines changed

8 files changed

+52
-33
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: |
3434
go mod download
3535
- name: Build and run tests
36-
run: ./scripts/run-unit-tests.sh ALL
36+
run: ./scripts/run-unit-tests.sh
3737
- name: Install goveralls
3838
run: go install github.com/mattn/goveralls@latest
3939
- name: Send coverage

.github/workflows/test.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ jobs:
2323
run: |
2424
go mod download
2525
- name: Build and run tests
26-
run: ./scripts/run-unit-tests.sh ALL
26+
run: ./scripts/run-unit-tests.sh
2727
- name: Install goveralls
2828
run: go install github.com/mattn/goveralls@latest
29+
- name: list files
30+
run: |
31+
ls -R ./testTarget/unit
2932
- name: Send coverage
3033
env:
3134
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
32-
run: goveralls -coverprofile=./testTarget/unit/cover.out -service=github
35+
run: goveralls -coverprofile=./testTarget/unit/cover.final.out -service=github
3336
- uses: actions/upload-artifact@v4
3437
with:
3538
name: libtokenizers.a

compose-test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ services:
2323
environment:
2424
- HOST_UID=$host_uid
2525
- CI=$CI
26-
- HUGOT_BUILD_TAG=$HUGOT_BUILD_TAG
2726
command: /run-unit-tests-container.sh
2827
# deploy:
2928
# resources:

hugot_go_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
//go:build GO || ALL
2+
13
package hugot
24

35
import (
46
"encoding/json"
57
"fmt"
8+
"os"
69
"testing"
710
)
811

@@ -129,7 +132,7 @@ func TestCrossEncoderPipelineValidationGo(t *testing.T) {
129132
// Image classification
130133

131134
func TestImageClassificationPipelineGo(t *testing.T) {
132-
session, err := NewXLASession()
135+
session, err := NewGoSession()
133136
checkT(t, err)
134137
defer func(session *Session) {
135138
destroyErr := session.Destroy()
@@ -139,7 +142,7 @@ func TestImageClassificationPipelineGo(t *testing.T) {
139142
}
140143

141144
func TestImageClassificationPipelineValidationGo(t *testing.T) {
142-
session, err := NewXLASession()
145+
session, err := NewGoSession()
143146
checkT(t, err)
144147
defer func(session *Session) {
145148
destroyErr := session.Destroy()
@@ -173,6 +176,9 @@ func TestDestroyPipelineGo(t *testing.T) {
173176
// Thread safety
174177

175178
func TestThreadSafetyGo(t *testing.T) {
179+
if os.Getenv("CI") != "" {
180+
t.SkipNow()
181+
}
176182
session, err := NewGoSession()
177183
checkT(t, err)
178184
defer func(session *Session) {

hugot_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ func imageClassificationPipeline(t *testing.T, session *Session) {
916916
func imageClassificationPipelineValidation(t *testing.T, session *Session) {
917917
t.Helper()
918918

919-
modelPath := "./models/KnightsAnalytics_resnet50-onnx"
919+
modelPath := "./models/KnightsAnalytics_resnet50"
920920
config := ImageClassificationConfig{
921921
ModelPath: modelPath,
922922
Name: "testImageClassification",

hugot_training_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build (ORT && XLA) || ALL
1+
//go:build (ORT && XLA && TRAINING) || ALL
22

33
package hugot
44

scripts/run-unit-tests-container.sh

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,45 @@
22

33
set -e
44

5+
folder=/test/unit
6+
57
cd /build && \
6-
mkdir -p /test/unit && \
8+
mkdir -p $folder && \
79
go run ./testData/downloadModels.go
810

9-
echo HUGOT_BUILD_TAG is "$HUGOT_BUILD_TAG"
11+
echo "Running ORT tests..."
12+
13+
gotestsum --format testname --junitfile=$folder/unit-onnx.xml --jsonfile=$folder/unit-onnx.json -- -coverprofile=$folder/cover-ort.out -coverpkg ./... -tags=ORT -timeout 60m -race
14+
15+
echo "ORT tests completed."
16+
17+
echo "Running XLA tests..."
18+
19+
gotestsum --format testname --junitfile=$folder/unit-xla.xml --jsonfile=$folder/unit-xla.json -- -coverprofile=$folder/cover-xla.out -coverpkg ./... -tags=XLA -timeout 60m -race
20+
21+
echo "XLA tests completed."
22+
23+
echo "Running training tests..."
24+
25+
gotestsum --format testname --junitfile=$folder/unit-training.xml --jsonfile=$folder/unit-training.json -- -coverprofile=$folder/cover-training.out -coverpkg ./... -tags=ORT,XLA,TRAINING -timeout 60m -race
26+
27+
echo "Training tests completed."
28+
29+
# echo "Running simplego tests..."
30+
31+
# gotestsum --format testname --junitfile=$folder/unit-go.xml --jsonfile=$folder/unit-go.json -- -tags=GO -timeout 60m
32+
33+
# echo "simplego tests completed."
1034

11-
if [[ -n $HUGOT_BUILD_TAG ]]; then
12-
echo "running with -tags=ALL"
13-
gotestsum --junitfile=/test/unit/unit.xml --jsonfile=/test/unit/unit.json -- -tags=ALL -coverprofile=/test/unit/cover.out.pre -coverpkg ./... -timeout 60m -race -covermode=atomic ./...
14-
else
15-
echo "running without build tags"
16-
gotestsum --junitfile=/test/unit/unit.xml --jsonfile=/test/unit/unit.json -- -coverprofile=/test/unit/cover.out.pre ./... -timeout 60m -race -covermode=atomic ./...
17-
fi
35+
Merge coverage files manually
36+
echo "merging coverage"
37+
head -n 1 $folder/cover-ort.out > $folder/cover.out
38+
tail -n +2 $folder/cover-ort.out >> $folder/cover.out
39+
tail -n +2 $folder/cover-xla.out >> $folder/cover.out
40+
tail -n +2 $folder/cover-training.out >> $folder/cover.out
41+
# tail -n +2 $folder/cover-go.out >> $folder/cover.out
1842

19-
grep -v "downloadModels.go" /test/unit/cover.out.pre > /test/unit/cover.out && rm /test/unit/cover.out.pre
43+
# # Optionally, remove downloadModels.go lines
44+
grep -v "downloadModels.go" $folder/cover.out > $folder/cover.final.out
2045

21-
echo Done.
46+
echo Done.

scripts/run-unit-tests.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ mkdir -p "$test_folder"
1515
host_uid=$(id -u "$USER")
1616
export host_uid
1717

18-
if [ $# -eq 0 ]; then
19-
echo "running without build tags"
20-
export HUGOT_BUILD_TAG=""
21-
else
22-
first_arg=$1
23-
if [[ $first_arg == "ALL" ]]; then
24-
echo "running with build tag ALL"
25-
export HUGOT_BUILD_TAG="ALL"
26-
else
27-
echo "build tag $first_arg is not supported"
28-
exit 1
29-
fi
30-
fi
31-
3218
# build with compose
3319
docker compose -f "$src_dir/compose-test.yaml" build hugot && \
3420
docker compose -f "$src_dir/compose-test.yaml" build hugot-test

0 commit comments

Comments
 (0)