Skip to content

Commit 48a57f3

Browse files
committed
improve tests to run on all platforms
1 parent 2c3e299 commit 48a57f3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ permissions:
55
pull-requests: write
66
jobs:
77
test:
8-
name: test
9-
runs-on: ubuntu-latest
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, macos-latest, windows-latest]
12+
1013
steps:
1114
- name: checkout
1215
uses: actions/checkout@v4
@@ -22,6 +25,7 @@ jobs:
2225

2326
- name: check test coverage
2427
id: coverage
28+
if: runner.os == 'Linux'
2529
uses: vladopajic/go-test-coverage@v2
2630
with:
2731
config: ./.github/.testcoverage.yml
@@ -30,6 +34,7 @@ jobs:
3034

3135
# Post coverage report as comment
3236
- name: find pull request ID
37+
if: runner.os == 'Linux'
3338
run: |
3439
PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
3540
"https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ github.ref_name }}&state=open")
@@ -41,15 +46,15 @@ jobs:
4146
echo "No open pull request found for this branch."
4247
fi
4348
- name: find if coverage report is already present
44-
if: env.pull_request_id
49+
if: env.pull_request_id && runner.os == 'Linux'
4550
uses: peter-evans/find-comment@v3
4651
id: fc
4752
with:
4853
issue-number: ${{ env.pull_request_id }}
4954
comment-author: 'github-actions[bot]'
5055
body-includes: 'go-test-coverage report:'
5156
- name: post coverage report
52-
if: env.pull_request_id
57+
if: env.pull_request_id && runner.os == 'Linux'
5358
uses: peter-evans/create-or-update-comment@v4
5459
with:
5560
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)