File tree Expand file tree Collapse file tree 2 files changed +74
-5
lines changed
Expand file tree Collapse file tree 2 files changed +74
-5
lines changed Original file line number Diff line number Diff line change @@ -58,13 +58,61 @@ jobs:
5858
5959 echo "result=$RESULT" >> $GITHUB_OUTPUT
6060
61- test :
61+ tests-collector :
62+ runs-on : ubuntu-latest
6263 needs : run-determination
6364 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
6475
76+ test-integration :
77+ needs : tests-collector
6578 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
6792
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+ needs : test-integration
115+ strategy :
68116 matrix :
69117 operating-system :
70118 - ubuntu-latest
93141 version : 3.x
94142
95143 - name : Run tests
96- run : task go:test
144+ run : |
145+ task go:test
97146
98147 - name : Run unit tests on the legacy package
99148 # Run legacy tests on one platform only
Original file line number Diff line number Diff line change @@ -105,6 +105,23 @@ tasks:
105105 {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} \
106106 {{.TEST_LDFLAGS}}
107107
108+ go:integration-test :
109+ desc : Run unit tests and 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+
108125 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-integration-task/Taskfile.yml
109126 go:test-integration :
110127 desc : Run integration tests
@@ -342,10 +359,13 @@ tasks:
342359vars :
343360 PROJECT_NAME : " arduino-cli"
344361 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
346363 DEFAULT_GO_PACKAGES :
347364 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"')
349369 # build vars
350370 COMMIT :
351371 sh : echo "$(git log --no-show-signature -n 1 --format=%h)"
You can’t perform that action at this time.
0 commit comments