Skip to content

Commit 0cde92a

Browse files
authored
Merge pull request #20 from launchdarkly/dg/sc-246713/migrate-go-test-helpers-to-github-actions
sc 246713 - migrate go test helpers to GitHub actions
2 parents 58e4887 + 7daf54a commit 0cde92a

File tree

2 files changed

+70
-82
lines changed

2 files changed

+70
-82
lines changed

.circleci/config.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

.github/workflows/go-test.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
on:
2+
- pull_request
3+
4+
5+
env:
6+
TEST_REPORTS: /tmp/reports
7+
ARTIFACTS: /tmp/artifacts
8+
9+
jobs:
10+
go-test-linux:
11+
strategy:
12+
matrix:
13+
go:
14+
- version: '1.18'
15+
run_lint: 'false'
16+
- version: '1.19'
17+
run_lint: 'true'
18+
19+
name: Go Test (Linux)
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
24+
25+
- name: Setup Go
26+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
27+
with:
28+
go-version: ${{ matrix.go.version }}
29+
30+
- name: Install go-junit-report
31+
run: go install github.com/jstemmer/go-junit-report/[email protected]
32+
33+
- name: Lint
34+
run: make lint
35+
if: ${{ matrix.go.run_lint == 'true' }}
36+
37+
- name: Test
38+
run: |
39+
mkdir -p $TEST_REPORTS
40+
mkdir -p $ARTIFACTS
41+
trap "go-junit-report < $ARTIFACTS/report.txt > $TEST_REPORTS/junit.xml" EXIT
42+
make test | tee $ARTIFACTS/report.txt
43+
44+
- name: Collect test reports
45+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
46+
with:
47+
path: ${{ env.TEST_REPORTS }}
48+
name: reports-${{ matrix.go.version }}
49+
50+
- name: Collect artifacts
51+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
52+
with:
53+
path: ${{ env.ARTIFACTS }}
54+
name: artifacts-${{ matrix.go.version }}
55+
56+
go-test-windows:
57+
name: Go Test (windows)
58+
runs-on: windows-latest
59+
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
63+
64+
- name: Setup Go
65+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
66+
with:
67+
go-version: '1.18.5'
68+
69+
- name: Test
70+
run: go test -race ./...

0 commit comments

Comments
 (0)