Skip to content

Commit b0fb426

Browse files
committed
ci: have a dedicated job to test platform specific tests
This change adds another job to the CI which can will test on platforms other than ubuntu-latest. At the moment it's only testing macos-latest with the fetcher tests but can be expanded in either direction. Signed-off-by: crozzy <joseph.crosland@gmail.com>
1 parent cd7e256 commit b0fb426

1 file changed

Lines changed: 30 additions & 8 deletions

File tree

.github/workflows/main.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,10 @@ jobs:
6969

7070
tests:
7171
name: Tests
72-
runs-on: ${{ matrix.os }}
72+
runs-on: ubuntu-latest
7373
strategy:
7474
fail-fast: false
7575
matrix:
76-
os:
77-
- ubuntu-latest
78-
- macos-latest
7976
go:
8077
- 'stable'
8178
- 'oldstable'
@@ -85,7 +82,7 @@ jobs:
8582
uses: actions/cache@v5
8683
with:
8784
path: ~/ok-by-run
88-
key: commit-ok-${{ matrix.os }}-${{ matrix.go }}-${{ github.sha }}
85+
key: commit-ok-${{ matrix.go }}-${{ github.sha }}
8986
- name: Checkout
9087
if: steps.previous.outputs.cache-hit != 'true'
9188
uses: actions/checkout@v6
@@ -107,13 +104,19 @@ jobs:
107104
- name: Tests
108105
run: |
109106
if test -f ~/ok-by-run; then
110-
echo "::notice title=Commit Previously Passed::See $(cat ~/ok-by-run) (cache key 'commit-ok-${{ matrix.os }}-${{ matrix.go }}-${{ github.sha }}')"
107+
echo "::notice title=Commit Previously Passed::See $(cat ~/ok-by-run) (cache key 'commit-ok-${{ matrix.go }}-${{ github.sha }}')"
111108
exit 0
112109
fi
113110
printf '%s/%s/actions/runs/%s/attempts/%s\n'\
114111
"${GITHUB_SERVER_URL}" "${GITHUB_REPOSITORY}" "${GITHUB_RUN_ID}" "${GITHUB_RUN_ATTEMPT}"\
115112
> ~/ok-by-run
116-
go test -race ${RUNNER_DEBUG:+-v} -run TestFetchSimple ./libindex/
113+
find . -name .git -prune -o -name testdata -prune -o -name go.mod -print | xargs -n1 dirname |
114+
while read -r dir; do (
115+
cd "$dir"
116+
go list -m
117+
go mod download
118+
GOMAXPROCS=2 go test -race ${RUNNER_DEBUG:+-v} "-coverprofile=${{ runner.temp }}/$(go list -m | tr / _).codecov.out" -covermode=atomic ./...
119+
); done
117120
- name: Codecov
118121
if: >-
119122
steps.previous.outputs.cache-hit != 'true' &&
@@ -124,9 +127,28 @@ jobs:
124127
directory: ${{ runner.temp }}
125128
override_branch: ${{ github.ref_name }}
126129
- name: Database Logs
127-
if: (failure() || env.RUNNER_DEBUG == 1) && runner.os == 'Linux'
130+
if: failure() || env.RUNNER_DEBUG == 1
128131
run: |
129132
sudo -u postgres psql -c 'SELECT version();'
130133
sudo journalctl --unit postgresql.service --boot -0
131134
ls /var/log/postgresql/postgresql-*.log
132135
sudo cat /var/log/postgresql/postgresql-*.log
136+
137+
platform-tests:
138+
name: Platform Tests
139+
runs-on: ${{ matrix.os }}
140+
strategy:
141+
fail-fast: false
142+
matrix:
143+
os:
144+
- macos-latest
145+
steps:
146+
- name: Checkout
147+
uses: actions/checkout@v6
148+
with:
149+
persist-credentials: false
150+
- uses: actions/setup-go@v6
151+
with:
152+
go-version: stable
153+
- name: Test Fetcher
154+
run: go test -race -v -run TestFetch ./libindex/

0 commit comments

Comments
 (0)