From 1b79d7a1553071af656d0eb34c2c1f21070de789 Mon Sep 17 00:00:00 2001 From: Nymphium Date: Thu, 6 Jul 2023 15:13:16 +0900 Subject: [PATCH] Refactor CI --- .github/workflows/test.yml | 51 ++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9fb09af..b882e50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 @@ -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