Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run new PostgreSQL backend tests #3407

Merged
merged 19 commits into from
Sep 22, 2023
Prev Previous commit
Next Next commit
Extract workflow
  • Loading branch information
AlekSi committed Sep 21, 2023
commit 7fe4a1c98ecb0ebc14e3fc2d4aef17a50df85ca7
41 changes: 41 additions & 0 deletions .github/workflows/go-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Go Cron
on:
schedule:
- cron: "12 0 * * *"

env:
GOPATH: /home/runner/go
GOCACHE: /home/runner/go/cache
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
GOTOOLCHAIN: local

jobs:
cron-integration:
name: >
Cron Integration ${{ matrix.name }} ${{ matrix.shard_index }}/${{ matrix.shard_total }}
(pushdown=${{ !(matrix.disable_filter_pushdown || false) }})

# Do not run this job in parallel for any PR change or branch push
# to save some resources.
concurrency:
group: ${{ github.workflow }}-cron-integration-${{ matrix.name }}-${{ matrix.shard_index }}-${{ matrix.disable_filter_pushdown || false }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

strategy:
fail-fast: false
matrix:
include:
- { name: "SQLite", task: "sqlite", shard_index: 1, shard_total: 3, disable_filter_pushdown: true }
- { name: "SQLite", task: "sqlite", shard_index: 2, shard_total: 3, disable_filter_pushdown: true }
- { name: "SQLite", task: "sqlite", shard_index: 3, shard_total: 3, disable_filter_pushdown: true }

uses: ./.github/workflows/go-integration.yml
with:
name: ${{ matrix.name }}
task: ${{ matrix.task }}
shard_index: ${{ matrix.shard_index }}
shard_total: ${{ matrix.shard_total }}
disable_filter_pushdown: ${{ matrix.disable_filter_pushdown || false }}
121 changes: 121 additions & 0 deletions .github/workflows/go-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
name: Go Integration
on:
workflow_call:
inputs:
name:
required: true
type: string
task:
required: true
type: string
shard_index:
required: true
type: number
shard_total:
required: true
type: number
disable_filter_pushdown:
required: true
type: boolean

env:
GOPATH: /home/runner/go
GOCACHE: /home/runner/go/cache
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
GOTOOLCHAIN: local

jobs:
integration:
name: >
Integration ${{ inputs.name }} ${{ inputs.shard_index }}/${{ inputs.shard_total }}
(pushdown=${{ !inputs.disable_filter_pushdown }})

# FIXME
runs-on: ubuntu-22.04
# runs-on:
# group: paid

timeout-minutes: 20

# Do not run this job in parallel for any PR change or branch push
# to save some resources.
concurrency:
group: ${{ github.workflow }}-integration-${{ inputs.name }}-${{ inputs.shard_index }}-${{ inputs.disable_filter_pushdown }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

steps:
- name: Setup permissions monitoring
uses: GitHubSecurityLab/actions-permissions/monitor@v1
if: false

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # for `git describe` to work
lfs: false # LFS is used only by website

- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: integration

- name: Install Task
run: go generate -x
working-directory: tools

- name: Start environment
run: bin/task env-up-detach

- name: Run init
run: bin/task init

- name: Wait for and setup environment
run: bin/task env-setup

- name: >
Run ${{ inputs.name }} tests
(${{ inputs.shard_index }}/${{ inputs.shard_total }}, pushdown=${{ !inputs.disable_filter_pushdown }})
run: >
bin/task test-integration-${{ inputs.task }}
SHARD_INDEX=${{ inputs.shard_index }}
SHARD_TOTAL=${{ inputs.shard_total }}
DISABLE_FILTER_PUSHDOWN=${{ inputs.disable_filter_pushdown }}
env:
GOFLAGS: ${{ runner.debug == '1' && '-v' || '' }}

# The token is not required but should make uploads more stable.
# If secrets are unavailable (for example, for a pull request from a fork), it fallbacks to the tokenless uploads.
#
# Unfortunately, it seems that tokenless uploads fail too often.
# See https://github.com/codecov/codecov-action/issues/837.
#
# We also can't use ${{ vars.CODECOV_TOKEN }}: https://github.com/orgs/community/discussions/44322
- name: Upload coverage information to codecov
if: always()
uses: codecov/codecov-action@v3
with:
token: 22159d7c-856d-4fe9-8fdb-5d9ecff35514
files: ./integration/integration-${{ inputs.task }}.txt
flags: integration,${{ inputs.task }}-${{ inputs.shard_index }},pushdown-${{ !inputs.disable_filter_pushdown }}
fail_ci_if_error: true
verbose: true

- name: Upload coverage information to coveralls
uses: coverallsapp/github-action@v2
with:
file: ./integration/integration-${{ inputs.task }}.txt
flag-name: integration-${{ inputs.task }}-${{ inputs.shard_index }}-pushdown-${{ !inputs.disable_filter_pushdown }}
parallel: true

# we don't want them on CI
- name: Clean test and fuzz caches
if: always()
run: go clean -testcache -fuzzcache

- name: Check dirty
run: |
git status
git diff --exit-code
93 changes: 7 additions & 86 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ jobs:
Integration ${{ matrix.name }} ${{ matrix.shard_index }}/${{ matrix.shard_total }}
(pushdown=${{ !(matrix.disable_filter_pushdown || false) }})

# FIXME
runs-on: ubuntu-22.04
# runs-on:
# group: paid

timeout-minutes: 20

# Do not run this job in parallel for any PR change or branch push
# to save some resources.
concurrency:
Expand All @@ -191,85 +184,13 @@ jobs:
- { name: "SQLite", task: "sqlite", shard_index: 2, shard_total: 3 }
- { name: "SQLite", task: "sqlite", shard_index: 3, shard_total: 3 }

# move that to cron-only workflow
# TODO https://github.com/FerretDB/FerretDB/issues/3126
- { name: "SQLite", task: "sqlite", shard_index: 1, shard_total: 3, disable_filter_pushdown: true }
- { name: "SQLite", task: "sqlite", shard_index: 2, shard_total: 3, disable_filter_pushdown: true }
- { name: "SQLite", task: "sqlite", shard_index: 3, shard_total: 3, disable_filter_pushdown: true }

steps:
- name: Setup permissions monitoring
uses: GitHubSecurityLab/actions-permissions/monitor@v1
if: false

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # for `git describe` to work
lfs: false # LFS is used only by website

- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: integration

- name: Install Task
run: go generate -x
working-directory: tools

- name: Start environment
run: bin/task env-up-detach

- name: Run init
run: bin/task init

- name: Wait for and setup environment
run: bin/task env-setup

- name: >
Run ${{ matrix.name }} tests
(${{ matrix.shard_index }}/${{ matrix.shard_total }}, pushdown=${{ !(matrix.disable_filter_pushdown || false) }})
run: >
bin/task test-integration-${{ matrix.task }}
SHARD_INDEX=${{ matrix.shard_index }}
SHARD_TOTAL=${{ matrix.shard_total }}
DISABLE_FILTER_PUSHDOWN=${{ matrix.disable_filter_pushdown || false }}
env:
GOFLAGS: ${{ runner.debug == '1' && '-v' || '' }}

# The token is not required but should make uploads more stable.
# If secrets are unavailable (for example, for a pull request from a fork), it fallbacks to the tokenless uploads.
#
# Unfortunately, it seems that tokenless uploads fail too often.
# See https://github.com/codecov/codecov-action/issues/837.
#
# We also can't use ${{ vars.CODECOV_TOKEN }}: https://github.com/orgs/community/discussions/44322
- name: Upload coverage information to codecov
if: always()
uses: codecov/codecov-action@v3
with:
token: 22159d7c-856d-4fe9-8fdb-5d9ecff35514
files: ./integration/integration-${{ matrix.task }}.txt
flags: integration,${{ matrix.task }}-${{ matrix.shard_index }},pushdown-${{ !(matrix.disable_filter_pushdown || false) }}
fail_ci_if_error: true
verbose: true

- name: Upload coverage information to coveralls
uses: coverallsapp/github-action@v2
with:
file: ./integration/integration-${{ matrix.task }}.txt
flag-name: integration-${{ matrix.task }}-${{ matrix.shard_index }}-pushdown-${{ !(matrix.disable_filter_pushdown || false) }}
parallel: true

# we don't want them on CI
- name: Clean test and fuzz caches
if: always()
run: go clean -testcache -fuzzcache

- name: Check dirty
run: |
git status
git diff --exit-code
uses: ./.github/workflows/go-integration.yml
with:
name: ${{ matrix.name }}
task: ${{ matrix.task }}
shard_index: ${{ matrix.shard_index }}
shard_total: ${{ matrix.shard_total }}
disable_filter_pushdown: ${{ matrix.disable_filter_pushdown || false }}

# https://github.com/lemurheavy/coveralls-public/issues/1636
submit-coveralls:
Expand Down