pinact #1
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: runTestsAndLinters | |
on: [push, pull_request] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go: [ "1.20", "1.19", "1.18" ] | |
os: [ ubuntu-22.04, ubuntu-20.04 ] | |
name: Tests Go ${{ matrix.go }} on ${{ matrix.os }} # This name is used in main branch protection rules | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup MySQL | |
run: | | |
echo -n "mysql -V: " ; mysql -V | |
echo -n "mysqldump -V: " ; mysqldump -V | |
echo -e '[mysqld]\nserver-id=1\nlog-bin=mysql\nbinlog-format=row\ngtid-mode=ON\nenforce_gtid_consistency=ON\n' | sudo tee /etc/mysql/conf.d/replication.cnf | |
sudo service mysql start | |
# apply this for mysql5 & mysql8 compatibility | |
sudo mysql -h 127.0.0.1 -uroot -proot -e "DROP USER IF EXISTS 'mysql.infoschema'@'localhost'; CREATE USER IF NOT EXISTS 'mysql.infoschema'@'localhost' IDENTIFIED BY ''; GRANT SELECT ON *.* TO 'mysql.infoschema'@'localhost';" | |
sudo mysql -h 127.0.0.1 -uroot -proot -e "use mysql; update user set authentication_string=null where User='root'; update user set plugin='mysql_native_password'; FLUSH PRIVILEGES;" | |
# create ssl/rsa files for mysql ssl support | |
sudo mysql_ssl_rsa_setup --uid=mysql | |
mysql -e "CREATE DATABASE IF NOT EXISTS test;" -uroot | |
mysql -e "SHOW VARIABLES LIKE 'log_bin'" -uroot | |
- name: Prepare for Go | |
run: | | |
sudo apt-get install -y make gcc | |
- name: Install Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Checkout code | |
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1.2.0 | |
- name: Run tests | |
run: | | |
# separate test to avoid RESET MASTER conflict | |
go test $(go list ./... | grep -v canal) | |
go test $(go list ./... | grep canal) | |
golangci: | |
name: golangci | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@5c56cd6c9dc07901af25baab6f2b0d9f3b7c3018 # v2.5.2 | |
with: | |
version: latest | |
args: --timeout=3m | |
platforms: | |
strategy: | |
matrix: | |
arch: [ "amd64", "arm64" ] | |
os: [ "linux", "freebsd", "darwin" ] | |
name: platforms | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare for Go | |
run: | | |
sudo apt-get install -y make gcc | |
- name: Install Go | |
uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 # v2.2.0 | |
with: | |
go-version: "1.20" | |
- name: Checkout code | |
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1.2.0 | |
- name: Build on ${{ matrix.os }}/${{ matrix.arch }} | |
run: GOARCH=${{ matrix.arch }} GOOS=${{ matrix.os }} go build ./... |