Update go directive to 1.21 and tidy module dependencies (#21) #38
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: CI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ "**" ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8 | |
| ports: | |
| - 9910:3306 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: gorm | |
| MYSQL_USER: gorm | |
| MYSQL_PASSWORD: gorm | |
| options: >- | |
| --health-cmd="mysqladmin ping -uroot -proot --silent" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22.x' | |
| - name: Go env | |
| run: go version && go env | |
| - name: Root module tests | |
| run: go test ./... | |
| - name: Wait for MySQL | |
| run: | | |
| for i in {1..60}; do | |
| if nc -z 127.0.0.1 9910; then echo "MySQL is up"; exit 0; fi | |
| sleep 1 | |
| done | |
| echo "MySQL did not become ready in time" >&2 | |
| exit 1 | |
| - name: Examples module tests (SQLite JSON1 + MySQL) | |
| env: | |
| CGO_ENABLED: '1' | |
| MYSQL_DSN: gorm:gorm@tcp(127.0.0.1:9910)/gorm?parseTime=true&charset=utf8mb4&loc=Local | |
| run: | | |
| cd examples | |
| go test -tags json1 ./... | |