@@ -56,21 +56,125 @@ jobs:
5656 strategy :
5757 matrix :
5858 platform : [ubuntu-latest, windows-latest]
59- go : [1.22.x]
60- name : ' ${{ matrix.platform }} | ${{ matrix.go }}'
59+ include :
60+ - platform : ubuntu-latest
61+ target : linux
62+ - platform : windows-latest
63+ target : windows
64+ name : ' Test (${{ matrix.target }})'
6165 runs-on : ${{ matrix.platform }}
6266 steps :
6367 - name : Harden the runner (Audit all outbound calls)
6468 uses : step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
6569 with :
6670 egress-policy : audit
6771
72+ - name : Install linux deps
73+ if : ${{ startsWith(matrix.platform, 'ubuntu') }}
74+ run : |
75+ sudo apt-get update
76+ sudo apt-get install \
77+ ninja-build
78+
79+ - name : Install windows deps
80+ if : ${{ startsWith(matrix.platform, 'windows') }}
81+ run : choco install -y ninja
82+
6883 - name : Check out repository code
6984 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
70- - name : Install go 1.22
85+
86+ - name : Install Go
7187 uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
7288 with :
73- go-version : ${{ matrix.go }}
89+ go-version-file : go.mod
90+ check-latest : true
91+ cache-dependency-path : |
92+ **/go.mod
93+ **/go.sum
94+
95+ - name : Install go-junit-report
96+ run : go install github.com/jstemmer/go-junit-report/v2@latest
97+
7498 - name : Unit testing
99+ run : |
100+ mkdir -p build
101+ go test -v ./... > build/vidx2pidxtests-${{ matrix.target }}-amd64.txt
102+
103+ - name : Generate JUnit test report
104+ if : always()
105+ run : |
106+ go-junit-report -set-exit-code -in build/vidx2pidxtests-${{ matrix.target }}-amd64.txt -iocopy -out build/vidx2pidx-testreport-${{ matrix.target }}-amd64.xml
107+
108+ - name : Archive unit test results
109+ uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
110+ with :
111+ name : test-results-${{ matrix.target }}
112+ path : ./build/vidx2pidx-testreport-*.xml
113+ if-no-files-found : error
114+
115+ publish-test-results :
116+ if : ${{ github.workflow != 'Release' }}
117+ name : " Publish Tests Results"
118+ needs : [ test ]
119+ runs-on : ubuntu-latest
120+ permissions :
121+ checks : write
122+ pull-requests : write
123+ steps :
124+ - name : Harden Runner
125+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
126+ with :
127+ egress-policy : audit
128+
129+ - name : Download Artifacts
130+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
131+ with :
132+ path : artifacts
133+
134+ - name : publish test results
135+ uses : EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
136+ with :
137+ files : " artifacts/**/vidx2pidx-testreport-*.xml"
138+ report_individual_runs : true
139+
140+ coverage :
141+ if : ${{ github.workflow != 'Release' && github.repository == 'Open-CMSIS-Pack/vidx2pidx' }}
142+ needs : [ test ]
143+ name : ' Coverage check'
144+ runs-on : ubuntu-latest
145+ steps :
146+ - name : Harden Runner
147+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
148+ with :
149+ egress-policy : audit
150+
151+ - name : Install dependencies
152+ run : |
153+ sudo apt-get update
154+ sudo apt-get install \
155+ ninja-build
156+
157+ - name : Check out repository code
158+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
159+
160+ - name : Install Go
161+ uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
162+ with :
163+ go-version-file : go.mod
164+ check-latest : true
165+ cache-dependency-path : |
166+ **/go.mod
167+ **/go.sum
168+
169+ - name : Check coverage
75170 run : |
76171 make coverage-check
172+
173+ - name : Publish coverage report to Code Climate
174+ uses : paambaati/codeclimate-action@f429536ee076d758a24705203199548125a28ca7 # v9.0.0
175+ env :
176+ CC_TEST_REPORTER_ID : ${{ secrets.CC_TEST_REPORTER_ID }}
177+ with :
178+ debug : true
179+ coverageLocations : ./cover.out:gocov
180+ prefix : github.com/Open-CMSIS-Pack/vidx2pidx
0 commit comments