Skip to content

Fix embedded package panic #24432

Fix embedded package panic

Fix embedded package panic #24432

Workflow file for this run

---
name: Go
on:
pull_request:
types:
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild
- opened
- reopened
- synchronize
push:
branches:
- main
- main-*
- releases/*
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:
short-test:
name: Short test
runs-on: ubuntu-22.04
timeout-minutes: 15
# Do not run this job in parallel for any PR change or branch push.
concurrency:
group: ${{ github.workflow }}-short-test-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
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: short-test
- name: Install Task
run: go generate -x
working-directory: tools
- name: Run init
run: bin/task init
- name: Run short unit tests
run: bin/task test-unit-short TEST_TIMEOUT=10m
env:
GOFLAGS: ${{ runner.debug == '1' && '-v' || '' }}
# 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
test:
name: Test
runs-on: ubuntu-22.04
timeout-minutes: 15
# Do not run this job in parallel for any PR change or branch push.
concurrency:
group: ${{ github.workflow }}-test-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
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: test
- 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: Regenerate and reformat
run: bin/task gen
- name: Build bin/ferretdb
run: bin/task build-host
- name: Wait for and setup environment
run: bin/task env-setup
- name: Run unit tests
run: bin/task test-unit TEST_TIMEOUT=10m
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@v4
with:
token: 22159d7c-856d-4fe9-8fdb-5d9ecff35514
files: ./cover.txt
flags: unit
fail_ci_if_error: true
verbose: true
- name: Upload coverage information to coveralls
uses: coverallsapp/github-action@v2
with:
file: ./cover.txt
flag-name: unit
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
integration:
# job name must be unique; make it unique and nice
name: ${{ matrix.task }} ${{ matrix.shard_index }}/${{ matrix.shard_total }}
# Do not run this job in parallel for any PR change or branch push
# to save some resources.
concurrency:
group: ${{ github.workflow }}-integration-${{ matrix.task }}-${{ matrix.shard_index }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
strategy:
fail-fast: false
matrix:
task: [postgresql, sqlite]
shard_index: [1, 2, 3, 4, 5]
shard_total: [5]
include:
- { task: "mongodb", shard_index: 1, shard_total: 1 }
uses: ./.github/workflows/_integration.yml
with:
task: ${{ matrix.task }}
shard_index: ${{ matrix.shard_index }}
shard_total: ${{ matrix.shard_total }}
coveralls: true
# https://github.com/lemurheavy/coveralls-public/issues/1636
submit-coveralls:
name: Submit final coveralls report
runs-on: ubuntu-22.04
needs: [test, integration]
if: always() && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready'))
steps:
- name: Submit coveralls
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
env-data:
name: env-data
runs-on: ubuntu-22.04
timeout-minutes: 10
# Do not run this job in parallel for any PR change or branch push.
concurrency:
group: ${{ github.workflow }}-env-data-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
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: env-data
- 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 env-data
run: bin/task env-data
env:
GOFLAGS: ${{ runner.debug == '1' && '-v' || '' }}
golangci-lint:
name: golangci-lint
runs-on: ubuntu-22.04
timeout-minutes: 10
# Do not run this job in parallel for any PR change or branch push.
concurrency:
group: ${{ github.workflow }}-golangci-lint-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # for `golangci-lint run --new` to work
lfs: false # LFS is used only by website
- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: lint
- name: Run linters
uses: FerretDB/github-actions/linters@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fuzz-short:
name: Fuzz short
runs-on: ubuntu-22.04
timeout-minutes: 15
# Do not run this job in parallel for any PR change or branch push.
concurrency:
group: ${{ github.workflow }}-fuzz-short-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
with:
path: source
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: fuzz
- name: Install Task
run: go generate -x
working-directory: source/tools
# TODO https://github.com/FerretDB/github-actions/issues/211
# Use deploy key instead of Personal Access Token (PAT) to limit access to one repository.
# If secrets are not available (for example, for a pull request from a fork), GITHUB_TOKEN PAT is used automatically.
- name: Checkout collected fuzz corpus
uses: actions/checkout@v4
with:
repository: FerretDB/fuzz-corpus
ssh-key: ${{ secrets.FUZZ_CORPUS_DEPLOY_KEY }}
path: fuzz-corpus
fetch-depth: 0 # for commit and push to work
- name: Setup corpus
run: bin/task fuzz-corpus
working-directory: source
# precompile tests with unset GOMAXPROCS
- name: Init fuzzers
run: bin/task fuzz-init
working-directory: source
# TODO https://github.com/FerretDB/FerretDB/issues/238
# TODO https://github.com/FerretDB/FerretDB/issues/344
- name: Fuzz
run: bin/task fuzz FUZZ_TIME=1m
working-directory: source
env:
GOMAXPROCS: 1 # otherwise, oom-killer kills fuzzer too often
- name: Collect corpus
if: always()
run: bin/task fuzz-corpus
working-directory: source
# `secrets` are not supported in `if`, so we have to do this trick with environment variable:
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
# https://github.com/actions/runner/issues/520
- name: Push corpus if possible
if: always() && env.KEY != ''
env:
KEY: ${{ secrets.FUZZ_CORPUS_DEPLOY_KEY }}
run: |
set -x
git config user.name ferretdb-bot
git config user.email ferretdb-bot@ferretdb.io
git add --all .
git diff-index -p HEAD
git diff-index --quiet HEAD || git commit --message 'Update corpus'
git fetch
git rebase origin/main
git push
working-directory: fuzz-corpus
- name: Compress corpus before upload
if: failure() || env.KEY == ''
env:
KEY: ${{ secrets.FUZZ_CORPUS_DEPLOY_KEY }}
run: zip -r -q -9 fuzz-corpus.zip fuzz-corpus
- name: Upload corpus on failure or if push is not possible
if: failure() || env.KEY == ''
env:
KEY: ${{ secrets.FUZZ_CORPUS_DEPLOY_KEY }}
uses: actions/upload-artifact@v4
with:
name: fuzz-corpus
path: fuzz-corpus.zip
retention-days: 1
if-no-files-found: error
- name: Collect Linux logs
if: failure()
run: |
mkdir -p /tmp/logs
ls -al /var/log/
sudo cp /var/log/syslog /tmp/logs/
sudo free > /tmp/logs/free.txt
sudo chmod 0666 /tmp/logs/*
working-directory: source
- name: Compress Linux logs before upload
if: failure()
run: zip -r -q -9 linux-logs.zip /tmp/logs
- name: Upload Linux logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: linux-logs
path: linux-logs.zip
retention-days: 1
if-no-files-found: error
# 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
working-directory: source