Skip to content

Commit c21e20e

Browse files
committed
Separate test/go into PostgreSQL
1 parent 44bd726 commit c21e20e

File tree

1 file changed

+50
-11
lines changed

1 file changed

+50
-11
lines changed

.github/workflows/coder.yaml

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,56 @@ jobs:
185185
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
186186
run: go run scripts/datadog-cireport/main.go gotests.xml
187187

188+
- uses: codecov/codecov-action@v2
189+
if: github.actor != 'dependabot[bot]'
190+
with:
191+
token: ${{ secrets.CODECOV_TOKEN }}
192+
files: ./gotests.coverage
193+
flags: unittest-go-${{ matrix.os }}
194+
fail_ci_if_error: true
195+
196+
test-go-postgres:
197+
name: "test/go/postgres"
198+
runs-on: ubuntu-latest
199+
steps:
200+
- uses: actions/checkout@v3
201+
202+
- uses: actions/setup-go@v2
203+
with:
204+
go-version: "^1.17"
205+
206+
- name: Echo Go Cache Paths
207+
id: go-cache-paths
208+
run: |
209+
echo "::set-output name=go-build::$(go env GOCACHE)"
210+
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
211+
212+
- name: Go Build Cache
213+
uses: actions/cache@v3
214+
with:
215+
path: ${{ steps.go-cache-paths.outputs.go-build }}
216+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
217+
218+
- name: Go Mod Cache
219+
uses: actions/cache@v3
220+
with:
221+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
222+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
223+
224+
- name: Install goreleaser
225+
uses: jaxxstorm/action-install-gh-release@v1.4.0
226+
env:
227+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
228+
with:
229+
repo: gotestyourself/gotestsum
230+
tag: v1.7.0
231+
232+
- uses: hashicorp/setup-terraform@v1
233+
with:
234+
terraform_version: 1.1.2
235+
terraform_wrapper: false
236+
188237
- name: Start PostgreSQL Database
189-
if: runner.os == 'Linux'
190238
env:
191239
POSTGRES_PASSWORD: postgres
192240
POSTGRES_USER: postgres
@@ -209,28 +257,19 @@ jobs:
209257
done
210258
211259
- name: Test with PostgreSQL Database
212-
if: runner.os == 'Linux'
213260
run: DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --
214261
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
215262
-coverpkg=./...,github.com/coder/coder/codersdk
216263
-count=1 -parallel=2 -race -failfast
217264

218265
- name: Upload DataDog Trace
219-
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux'
266+
if: (success() || failure()) && github.actor != 'dependabot[bot]'
220267
env:
221268
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
222269
DD_DATABASE: postgresql
223270
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
224271
run: go run scripts/datadog-cireport/main.go gotests.xml
225272

226-
- uses: codecov/codecov-action@v2
227-
if: github.actor != 'dependabot[bot]'
228-
with:
229-
token: ${{ secrets.CODECOV_TOKEN }}
230-
files: ./gotests.coverage
231-
flags: unittest-go-${{ matrix.os }}
232-
fail_ci_if_error: true
233-
234273
deploy:
235274
name: "deploy"
236275
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)