Make this a real fork: module path github.com/block/mysql, driver name block-mysql #24
Workflow file for this run
This file contains hidden or 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: | |
| workflow_dispatch: | |
| env: | |
| MYSQL_TEST_USER: gotest | |
| MYSQL_TEST_PASS: secret | |
| MYSQL_TEST_ADDR: 127.0.0.1:3306 | |
| MYSQL_TEST_CONCURRENT: 1 | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: dominikh/staticcheck-action@9716614d4101e79b4340dd97b10e54d68234e431 # v1.4.1 | |
| list: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: list | |
| id: set-matrix | |
| run: | | |
| import json | |
| import os | |
| go = [ | |
| # Keep the most recent production release at the top | |
| '1.27', | |
| # Older production releases | |
| '1.26', | |
| '1.25', | |
| ] | |
| # MySQL LTS versions. Upstream also covers MariaDB; this fork does | |
| # not, because Block does not deploy against it. | |
| mysql = [ | |
| '9.7', | |
| '8.4', | |
| '8.0', | |
| ] | |
| includes = [] | |
| # Go versions compatibility check | |
| for v in go[1:]: | |
| includes.append({'os': 'ubuntu-latest', 'go': v, 'mysql': mysql[0]}) | |
| matrix = { | |
| # MySQL versions. Upstream also runs macos-latest and | |
| # windows-latest; this fork is Linux-only, which additionally | |
| # avoids a Windows-runner TCP dial flake upstream sees too. | |
| 'os': [ 'ubuntu-latest' ], | |
| 'go': [ go[0] ], | |
| 'mysql': mysql, | |
| 'include': includes | |
| } | |
| output = json.dumps(matrix, separators=(',', ':')) | |
| with open(os.environ["GITHUB_OUTPUT"], 'a', encoding="utf-8") as f: | |
| print(f"matrix={output}", file=f) | |
| shell: python | |
| test: | |
| needs: list | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.list.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - uses: shogo82148/actions-setup-mysql@62da9377d83991fce27b6ed2a397d3306121e41d # v1.53.1 | |
| with: | |
| mysql-version: ${{ matrix.mysql }} | |
| user: ${{ env.MYSQL_TEST_USER }} | |
| password: ${{ env.MYSQL_TEST_PASS }} | |
| my-cnf: | | |
| innodb_buffer_pool_size=512MB | |
| max_allowed_packet=48MB | |
| ; TestConcurrent fails if max_connections is too large | |
| max_connections=50 | |
| local_infile=1 | |
| performance_schema=on | |
| - name: setup database | |
| run: | | |
| mysql --user 'root' --host '127.0.0.1' -e 'create database gotest;' | |
| - name: test | |
| run: | | |
| go test -v '-race' '-covermode=atomic' '-coverprofile=coverage.out' -parallel 10 | |
| - name: benchmark | |
| run: | | |
| go test -run '^$' -bench . | |
| - name: Send coverage | |
| uses: shogo82148/actions-goveralls@77a1912dca42260ee3e97f61bd13ea7ef40baa93 # v1.11.2 | |
| with: | |
| path-to-profile: coverage.out | |
| flag-name: ${{ runner.os }}-Go-${{ matrix.go }}-DB-${{ matrix.mysql }} | |
| parallel: true | |
| # notifies that all test jobs are finished. | |
| finish: | |
| needs: test | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: shogo82148/actions-goveralls@77a1912dca42260ee3e97f61bd13ea7ef40baa93 # v1.11.2 | |
| with: | |
| parallel-finished: true |