Skip to content

Commit

Permalink
Refactor CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Nymphium committed Jul 6, 2023
1 parent 96bf7a0 commit 1b79d7a
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
# - macOS-latest
# - windows-latest
go:
- "1.19.1"
- "1.19.10"
- "1.20.5"
- "1.21.0-rc.2"
services:
postgres:
image: postgres:12
Expand All @@ -31,31 +33,23 @@ jobs:
run: |
psql -U postgres -h localhost -d postgres -c 'CREATE USER dgw_test;'
psql -U postgres -h localhost -d postgres -c 'CREATE DATABASE dgw_test OWNER dgw_test;'
- name: Checkout code
uses: actions/checkout/@v3
- name: Install Go
uses: actions/setup-go/@v2
uses: actions/setup-go/@v4
with:
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout/@v3

- name: Download Go modules
shell: bash
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
run: go mod download
- name: Lint
uses: golangci/golangci-lint-action@v3

- name: Run test
run: go test -v

check-test-gen:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# Container operations, such as postgres, are only supported on Linux runners
# - macOS-latest
# - windows-latest
go:
- "1.19.1"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
Expand All @@ -70,17 +64,20 @@ jobs:
run: |
psql -U postgres -h localhost -d postgres -c 'CREATE USER dgw_test;'
psql -U postgres -h localhost -d postgres -c 'CREATE DATABASE dgw_test OWNER dgw_test;'
- name: Install Go
uses: actions/setup-go/@v2
with:
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout/@v3

- name: Lint
uses: golangci/golangci-lint-action@v3

- name: Install Go
uses: actions/setup-go/@v4
with:
go-version: "1.20.5"
- name: Download Go modules
shell: bash
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
run: go mod download
- name: Install deps
run: |
go install golang.org/x/tools/cmd/goimports@latest
go install
- name: Generate
run: go generate -v ./example
- name: Check diff
Expand Down

0 comments on commit 1b79d7a

Please sign in to comment.