File tree 3 files changed +38
-7
lines changed
3 files changed +38
-7
lines changed Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+ import json
3
+
4
+
5
+ if __name__ == "__main__" :
6
+ import sys
7
+
8
+ tests_path = sys .argv [1 ]
9
+
10
+ test_files = [str (f ).split ("/" )[- 2 ] for f in Path (tests_path ).glob ("*/*_test.go" )]
11
+ test_files = list (dict .fromkeys (test_files ))
12
+ print (json .dumps (test_files ))
Original file line number Diff line number Diff line change @@ -58,18 +58,30 @@ jobs:
58
58
59
59
echo "result=$RESULT" >> $GITHUB_OUTPUT
60
60
61
- test :
61
+ tests-collector :
62
+ runs-on : ubuntu-latest
62
63
needs : run-determination
63
64
if : needs.run-determination.outputs.result == 'true'
65
+ outputs :
66
+ tests-data : ${{ steps.collection.outputs.tests-data }}
67
+ steps :
68
+ - name : Checkout repository
69
+ uses : actions/checkout@v3
64
70
65
- strategy :
66
- fail-fast : false
71
+ - name : Collect tests
72
+ id : collection
73
+ run : |
74
+ echo "tests-data=$(python .github/tools/get_go_integration_tests.py ./internal/integrationtest)" >> $GITHUB_OUTPUT
67
75
76
+ test :
77
+ needs : tests-collector
78
+ strategy :
68
79
matrix :
69
80
operating-system :
70
81
- ubuntu-latest
71
82
- windows-latest
72
83
- macos-latest
84
+ tests : ${{ fromJSON(needs.tests-collector.outputs.tests-data) }}
73
85
74
86
runs-on : ${{ matrix.operating-system }}
75
87
@@ -93,7 +105,10 @@ jobs:
93
105
version : 3.x
94
106
95
107
- name : Run tests
96
- run : task go:test
108
+ shell : bash
109
+ run : |
110
+ export GO_TEST_PACKAGE="github.com/arduino/arduino-cli/internal/integrationtest/${{ matrix.tests }}"
111
+ task go:test
97
112
98
113
- name : Run unit tests on the legacy package
99
114
# Run legacy tests on one platform only
Original file line number Diff line number Diff line change @@ -99,10 +99,11 @@ tasks:
99
99
go test \
100
100
-v \
101
101
-short \
102
+ {{ .GO_TEST_PACKAGE }} \
102
103
-run '{{default ".*" .GO_TEST_REGEX}}' \
103
104
{{default "-timeout 20m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} \
104
105
-coverprofile=coverage_unit.txt \
105
- {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} \
106
+ {{default .DEFAULT_INTEGRATIONTEST_GO_PACKAGES .GO_PACKAGES}} \
106
107
{{.TEST_LDFLAGS}}
107
108
108
109
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-integration-task/Taskfile.yml
@@ -342,10 +343,13 @@ tasks:
342
343
vars :
343
344
PROJECT_NAME : " arduino-cli"
344
345
DIST_DIR : " dist"
345
- # all modules of this project except for "legacy/..." module
346
+ # all modules of this project except for "legacy/..." module and integration test
346
347
DEFAULT_GO_PACKAGES :
347
348
sh : |
348
- echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v legacy | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
349
+ echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v internal/integrationtest | grep -v legacy | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
350
+ DEFAULT_INTEGRATIONTEST_GO_PACKAGES :
351
+ sh : |
352
+ echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep internal/integrationtest | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
349
353
# build vars
350
354
COMMIT :
351
355
sh : echo "$(git log --no-show-signature -n 1 --format=%h)"
You can’t perform that action at this time.
0 commit comments