File tree 2 files changed +71
-4
lines changed
2 files changed +71
-4
lines changed Original file line number Diff line number Diff line change @@ -58,13 +58,60 @@ 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
70
+
71
+ - name : Collect tests
72
+ id : collection
73
+ run : |
74
+ echo "tests-data=$(go list ./internal/integrationtest/... | grep integrationtest/ | tr "/" " " | cut -d " " -f 6 | jq -cR '[inputs]')" >> $GITHUB_OUTPUT
64
75
76
+ test-integration :
77
+ needs : tests-collector
65
78
strategy :
66
- fail-fast : false
79
+ matrix :
80
+ operating-system :
81
+ - ubuntu-latest
82
+ - windows-latest
83
+ - macos-latest
84
+ tests : ${{ fromJSON(needs.tests-collector.outputs.tests-data) }}
85
+
86
+ runs-on : ${{ matrix.operating-system }}
87
+
88
+ steps :
89
+ # By default, actions/checkout converts the repo's LF line endings to CRLF on the Windows runner.
90
+ - name : Disable EOL conversions
91
+ run : git config --global core.autocrlf false
67
92
93
+ - name : Checkout repository
94
+ uses : actions/checkout@v3
95
+
96
+ - name : Install Go
97
+ uses : actions/setup-go@v3
98
+ with :
99
+ go-version : ${{ env.GO_VERSION }}
100
+
101
+ - name : Install Task
102
+ uses : arduino/setup-task@v1
103
+ with :
104
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
105
+ version : 3.x
106
+
107
+ - name : Run tests
108
+ shell : bash
109
+ run : |
110
+ export GO_TEST_PACKAGE="github.com/arduino/arduino-cli/internal/integrationtest/${{ matrix.tests }}"
111
+ task go:integration-test
112
+
113
+ test :
114
+ strategy :
68
115
matrix :
69
116
operating-system :
70
117
- ubuntu-latest
Original file line number Diff line number Diff line change @@ -105,6 +105,23 @@ tasks:
105
105
{{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} \
106
106
{{.TEST_LDFLAGS}}
107
107
108
+ go:integration-test :
109
+ desc : Run the Go-based integration tests
110
+ deps :
111
+ - task : go:build
112
+ dir : ' {{default "./" .GO_MODULE_PATH}}'
113
+ cmds :
114
+ - |
115
+ go test \
116
+ -v \
117
+ -short \
118
+ {{ .GO_TEST_PACKAGE }} \
119
+ -run '{{default ".*" .GO_TEST_REGEX}}' \
120
+ {{default "-timeout 20m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} \
121
+ -coverprofile=coverage_unit.txt \
122
+ {{default .DEFAULT_INTEGRATIONTEST_GO_PACKAGES .GO_PACKAGES}} \
123
+ {{.TEST_LDFLAGS}}
124
+
108
125
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-integration-task/Taskfile.yml
109
126
go:test-integration :
110
127
desc : Run integration tests
@@ -342,10 +359,13 @@ tasks:
342
359
vars :
343
360
PROJECT_NAME : " arduino-cli"
344
361
DIST_DIR : " dist"
345
- # all modules of this project except for "legacy/..." module
362
+ # all modules of this project except for "legacy/..." module and integration test
346
363
DEFAULT_GO_PACKAGES :
347
364
sh : |
348
- echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v legacy | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
365
+ echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep -v internal/integrationtest | grep -v legacy | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
366
+ DEFAULT_INTEGRATIONTEST_GO_PACKAGES :
367
+ sh : |
368
+ echo $(cd {{default "./" .GO_MODULE_PATH}} && go list ./... | grep internal/integrationtest | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
349
369
# build vars
350
370
COMMIT :
351
371
sh : echo "$(git log --no-show-signature -n 1 --format=%h)"
You can’t perform that action at this time.
0 commit comments