Merge pull request #283 from stephenafamo/context #759
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ 'oldstable', 'stable' ] | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: pass | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -ppass" | |
--health-interval 10s | |
--health-start-period 10s | |
--health-timeout 5s | |
--health-retries 10 | |
steps: | |
- name: MySQL Setup | |
run: > | |
echo -e "[client]\nuser = root\npassword = pass\nhost = localhost\nprotocol = tcp" > $HOME/.my.cnf | |
&& chmod 600 $HOME/.my.cnf | |
&& mysql --execute 'CREATE DATABASE dialect_droppable;' | |
&& mysql --execute 'CREATE DATABASE driver_droppable;' | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: true | |
- name: Install Dependencies | |
run: go mod download | |
- name: Run tests | |
env: | |
MYSQL_DIALECT_TEST_DSN: root:pass@(localhost:3306)/dialect_droppable?tls=skip-verify&multiStatements=true | |
MYSQL_DRIVER_TEST_DSN: root:pass@(localhost:3306)/driver_droppable?tls=skip-verify&multiStatements=true | |
run: go test -timeout 20m -race -covermode atomic -coverprofile=covprofile.out -coverpkg=github.com/stephenafamo/bob/... ./... | |
- name: Send coverage | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: covprofile.out | |
flag-name: go-${{ matrix.go }} | |
parallel: true | |
finish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
parallel-finished: true | |
test-windows-sqlite: | |
# Run generation test on windows to catch filepath issues | |
# Testing Postgres and MySQL are not possible since the windows runner | |
# does not support containers | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
go: ['stable' ] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: true | |
- name: Install Dependencies | |
run: go mod download | |
- name: Run tests | |
run: go test -race ./gen/bobgen-sqlite/driver |