67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: checks
|
|
on:
|
|
- push
|
|
- pull_request
|
|
|
|
env:
|
|
GOPROXY: https://goproxy.io,direct
|
|
GOPATH: /go_path
|
|
GOCACHE: /go_cache
|
|
|
|
jobs:
|
|
lint:
|
|
name: check and test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: cache go path
|
|
id: cache-go-path
|
|
uses: https://github.com/actions/cache@v3
|
|
with:
|
|
path: /go_path
|
|
key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
|
restore-keys: |
|
|
go_path-${{ github.repository }}-
|
|
go_path-
|
|
- name: cache go cache
|
|
id: cache-go-cache
|
|
uses: https://github.com/actions/cache@v3
|
|
with:
|
|
path: /go_cache
|
|
key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
|
restore-keys: |
|
|
go_cache-${{ github.repository }}-
|
|
go_cache-
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.20
|
|
- uses: https://github.com/actions/checkout@v3
|
|
- name: vet
|
|
run: make vet
|
|
- name: format check
|
|
run: make fmt-check
|
|
- name: unit test
|
|
run: make test
|
|
- name: test sqlite3
|
|
run: make test-sqlite3
|
|
- name: test sqlite3 with cache
|
|
run: TEST_CACHE_ENABLE=true make test-sqlite3
|
|
- name: test sqlite3 with quote policy
|
|
run: TEST_QUOTE_POLICY=reserved make test-sqlite
|
|
- name: test mysql
|
|
env:
|
|
TEST_MYSQL_HOST: mysql
|
|
TEST_MYSQL_CHARSET: utf8
|
|
TEST_MYSQL_DBNAME: xorm_test
|
|
TEST_MYSQL_USERNAME: root
|
|
TEST_MYSQL_PASSWORD:
|
|
run: TEST_CACHE_ENABLE=true make test-mysql
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:5.7
|
|
env:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
MYSQL_DATABASE: xorm_test
|
|
ports:
|
|
- 3306:3306
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |