Skip to content

Commit

Permalink
Update CI workflows to utilize latest gh actions and test against lat…
Browse files Browse the repository at this point in the history
…est major db versions and go versions. Updated tests scripts to match ci docker tests.
  • Loading branch information
funkyshu committed Jul 31, 2023
1 parent 31d438d commit 2a7d542
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,28 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: ["1.15", "1.16", "latest"]
go_version: ["1.19", "latest"]
db_versions:
- mysql_version: 5
postgres_version: 9.6
sqlserver_version: "2017-CU8-ubuntu"
- mysql_version: 5
postgres_version: "10.10"
sqlserver_version: "2017-CU8-ubuntu"
- mysql_version: 5.7
postgres_version: 9
sqlserver_version: "2017-latest"
- mysql_version: "8.0"
postgres_version: 10
sqlserver_version: "2019-latest"
- mysql_version: 8
postgres_version: 11.5
sqlserver_version: "2017-CU8-ubuntu"
postgres_version: 11
sqlserver_version: "2022-latest"
- mysql_version: 8
postgres_version: 15
sqlserver_version: "2022-latest"
env:
GO_VERSION: ${{ matrix.go_version }}
MYSQL_VERSION: ${{ matrix.db_versions.mysql_version }}
POSTGRES_VERSION: ${{ matrix.db_versions.postgres_version }}
SQLSERVER_VERSION: ${{ matrix.db_versions.sqlserver_version }}
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Test
run: docker-compose run goqu-coverage
- name: Upload coverage to Codecov
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.39.0
Expand All @@ -35,4 +39,4 @@ jobs:
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
# skip-build-cache: true
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:

goqu:
image: "golang:${GO_VERSION}"
command: ["./wait-for-it.sh", "postgres:5432", "--", "./wait-for-it.sh", "mysql:3306", "--", "go test -v -race ./..."]
command: ["./wait-for-it.sh", "postgres:5432", "--", "./wait-for-it.sh", "mysql:3306", "--", "./wait-for-it.sh", "sqlserver:1433", "--", "./go.test.sh"]
working_dir: /go/src/github.com/doug-martin/goqu
volumes:
- "./:/go/src/github.com/doug-martin/goqu"
Expand All @@ -48,7 +48,7 @@ services:
- sqlserver
goqu-coverage:
image: "golang:${GO_VERSION}"
command: ["./wait-for-it.sh", "postgres:5432", "--", "./wait-for-it.sh", "mysql:3306", "--", "./go.test.sh"]
command: ["./wait-for-it.sh", "postgres:5432", "--", "./wait-for-it.sh", "mysql:3306", "--", "./wait-for-it.sh", "sqlserver:1433", "--", "./go.coverage.sh"]
working_dir: /go/src/github.com/doug-martin/goqu
volumes:
- "./:/go/src/github.com/doug-martin/goqu"
Expand Down
6 changes: 6 additions & 0 deletions go.coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e
echo "" > coverage.txt

go test -coverprofile=coverage.txt -coverpkg=./... ./...
3 changes: 1 addition & 2 deletions go.test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash

set -e
echo "" > coverage.txt

go test -race -coverprofile=coverage.txt -coverpkg=./... ./...
go test -v -race ./...

0 comments on commit 2a7d542

Please sign in to comment.