/
githubmirror
/
fizz
Обзор
Документация
Войти
/
githubmirror
/
fizz
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/tests.yml
241 строка
7 KB
Yonghwan SO
fixed e2e test configuration: why does it run for only sqlite...
09 сен 2022, 20:45
09 сен 2022, 20:45
a1d9566
Код
Авторство
О чём код?
name: Tests on: push: branches: - main pull_request: jobs: mysql-tests: name: MySQL tests - Go v${{ matrix.go-version }} runs-on: ubuntu-latest strategy: matrix: go-version: - "1.17.x" - "1.18.x" services: mysql: image: mysql:5.7 env: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: pop_test MYSQL_PORT: 3307 ports: - 3307:3306 # needed because the mysql container does not provide a healthcheck options: --health-cmd "mysqladmin ping -h localhost" --health-interval 5s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v3 - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Install and run soda env: SODA_DIALECT: "mysql" MYSQL_PORT: 3307 run: | go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations soda migrate -e $SODA_DIALECT -p ./testdata/migrations - name: Test env: SODA_DIALECT: "mysql" MYSQL_PORT: 3307 run: | go test -v -tags sqlite -race ./... - name: Reset database and run e2e env: SODA_DIALECT: "mysql" run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations cd testdata/e2e go test -v -tags sqlite,e2e -race ./... pg-tests: name: PostgreSQL tests - Go v${{ matrix.go-version }} runs-on: ubuntu-latest strategy: matrix: go-version: - "1.17.x" - "1.18.x" services: postgres: image: postgres:10 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres ports: - 5433:5432 # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v3 - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Install and run soda env: SODA_DIALECT: "postgres" POSTGRESQL_URL: "postgres://postgres:postgres@${{job.services.postgres.host}}:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable" run: | go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations soda migrate -e $SODA_DIALECT -p ./testdata/migrations - name: Test env: SODA_DIALECT: "postgres" POSTGRESQL_URL: "postgres://postgres:postgres@${{job.services.postgres.host}}:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable" run: | go test -v -tags sqlite -race ./... - name: Reset database and run e2e env: SODA_DIALECT: "postgres" run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations cd testdata/e2e go test -v -tags sqlite,e2e -race ./... crdb-tests: name: Cockroach tests - Go v${{ matrix.go-version }} runs-on: ubuntu-latest strategy: matrix: go-version: - "1.17.x" - "1.18.x" steps: - uses: actions/checkout@v3 - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Install Cockroach run: | mkdir -p crdb pushd crdb wget -qO- https://binaries.cockroachdb.com/cockroach-v21.1.19.linux-amd64.tgz | tar -xz mv cockroach-v21.1.19.linux-amd64/* . ln -s `pwd`/cockroach /usr/local/bin/ cockroach version ./cockroach start-single-node --insecure --background popd - name: Install and run soda env: SODA_DIALECT: "cockroach" COCKROACH_PORT: 26257 run: | go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations soda migrate -e $SODA_DIALECT -p ./testdata/migrations - name: Test env: SODA_DIALECT: "cockroach" COCKROACH_PORT: 26257 run: | go test -v -tags sqlite -race ./... - name: Reset database and run e2e env: SODA_DIALECT: "cockroach" COCKROACH_PORT: 26257 run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations cd testdata/e2e go test -v -tags sqlite,e2e -race ./... sqlite-tests: name: SQLite tests ${{ matrix.os }} - Go v${{ matrix.go-version }} runs-on: ${{ matrix.os }} strategy: matrix: go-version: - "1.17.x" - "1.18.x" os: - "macos-latest" - "windows-latest" - "ubuntu-latest" steps: - name: Install sqlite3 run: choco install sqlite if: matrix.os == 'windows-latest' - uses: actions/checkout@v3 - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Install and run soda env: SODA_DIALECT: "sqlite" run: | go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations soda migrate -e $SODA_DIALECT -p ./testdata/migrations shell: bash - name: Test if: ${{ matrix.os != 'windows-latest' }} env: SODA_DIALECT: "sqlite" run: | go test -v -tags sqlite -race ./... shell: bash - name: Test without race detection if: ${{ matrix.os == 'windows-latest' }} env: SODA_DIALECT: "sqlite" run: | go test -v -tags sqlite ./... shell: bash - name: Reset database and run e2e if: ${{ matrix.os != 'windows-latest' }} env: SODA_DIALECT: "sqlite" run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations cd testdata/e2e go test -v -tags sqlite,e2e -race ./... shell: bash - name: Reset database and run e2e without race detection if: ${{ matrix.os == 'windows-latest' }} env: SODA_DIALECT: "sqlite" run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations cd testdata/e2e go test -v -tags sqlite,e2e ./... shell: bash