Skip to content

Commit 1f9ffcf

Browse files
authored
Build and test on multiple platforms (#408)
* Build and test on multiple platforms * Add only windows run * Run lint only in linux * Addressed review comments
1 parent ce76541 commit 1f9ffcf

2 files changed

Lines changed: 37 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,26 @@ permissions:
2525

2626
jobs:
2727
build:
28-
name: Build and test
29-
runs-on: [ubuntu-latest]
28+
strategy:
29+
matrix:
30+
platform: [ubuntu-24.04, windows-2022, macos-14]
31+
include:
32+
- platform: ubuntu-24.04
33+
target: linux
34+
- platform: windows-2022
35+
target: windows
36+
- platform: macos-14
37+
target: darwin
38+
runs-on: ${{ matrix.platform }}
39+
name: 'Build and test (${{ matrix.target }})'
40+
3041
steps:
3142
- name: Harden the runner (Audit all outbound calls)
3243
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
3344
with:
3445
egress-policy: audit
3546

47+
- run: git config --global core.autocrlf false
3648
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3749
with:
3850
fetch-depth: 0
@@ -46,7 +58,7 @@ jobs:
4658
cache: 'yarn'
4759

4860
- name: Set version
49-
if: github.repository_owner == 'Open-CMSIS-Pack'
61+
if: runner.os == 'Linux' && github.repository_owner == 'Open-CMSIS-Pack'
5062
run: |
5163
case ${{ github.event_name }} in
5264
release)
@@ -70,15 +82,24 @@ jobs:
7082
sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
7183
echo "Version is ${VERSION}"
7284
73-
- name: Remove Badges for dist
85+
- name: Remove badges
86+
if: runner.os == 'Linux'
7487
run: |
7588
sed -i "/https:\/\/qlty\.sh\/gh/d" README.md
7689
sed -i "/https:\/\/securityscorecards\.dev\/viewer/d" README.md
7790
78-
- name: Build
91+
- name: Install dependencies
7992
env:
80-
GITHUB_TOKEN: ${{github.token}}
81-
run: yarn --frozen-lockfile --prefer-offline
93+
GITHUB_TOKEN: ${{ github.token }}
94+
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts
95+
96+
- name: Build on Windows or macOS
97+
if: runner.os != 'Linux'
98+
run: yarn build:no-lint
99+
100+
- name: Build on Linux
101+
if: runner.os == 'Linux'
102+
run: yarn build
82103

83104
- name: Check copyright
84105
run: yarn copyright:check
@@ -87,6 +108,7 @@ jobs:
87108
run: yarn test
88109

89110
- name: Upload dist
111+
if: runner.os == 'Linux'
90112
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
91113
with:
92114
name: dist
@@ -98,7 +120,7 @@ jobs:
98120
retention-days: 1
99121

100122
- name: Commit changelog
101-
if: false && github.event_name == 'release'
123+
if: false && github.event_name == 'release' && runner.os == 'Linux'
102124
run: |
103125
sed -i '3i ## Unreleased\n' CHANGELOG.md
104126
git checkout main
@@ -109,17 +131,18 @@ jobs:
109131
git push
110132
111133
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
134+
if: runner.os == 'Linux'
112135
with:
113136
name: test-coverage
114137
path: ./coverage
115138

116139
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
117140
with:
118-
name: test-report
141+
name: test-report-${{ matrix.target }}
119142
path: ./test-report.html
120143

121144
- name: Publish coverage report to QLTY
122-
if: github.repository_owner == 'Open-CMSIS-Pack'
145+
if: github.repository_owner == 'Open-CMSIS-Pack' && runner.os == 'Linux'
123146
uses: qltysh/qlty-action/coverage@f13b3559771beedd11e68b03d49512f3c21a75ba # v1
124147
with:
125148
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
@@ -209,11 +232,11 @@ jobs:
209232
- name: Download test report
210233
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
211234
with:
212-
pattern: test-report
235+
pattern: test-report-linux
213236

214237
- name: Zip test report
215238
run: zip -r test-report.zip *
216-
working-directory: test-report
239+
working-directory: test-report-linux
217240

218241
- name: Zip test coverage
219242
run: zip -r test-coverage.zip *
@@ -225,5 +248,4 @@ jobs:
225248
files: |
226249
**/*.vsix
227250
test-coverage/test-coverage.zip
228-
test-report/test-report.zip
229-
251+
test-report-linux/test-report.zip

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"download-tools": "ts-node scripts/download-tools.ts",
9090
"clean": "git clean -f -x ./node_modules ./dist ./coverage ./tools",
9191
"build": "webpack --mode production && yarn lint",
92+
"build:no-lint": "webpack --mode production",
9293
"watch": "webpack -w",
9394
"lint": "eslint .",
9495
"test": "jest --reporters=default --reporters=./node_modules/jest-html-reporter",

0 commit comments

Comments
 (0)