Skip to content

[feat]: add custom allocator on lantern #741

[feat]: add custom allocator on lantern

[feat]: add custom allocator on lantern #741

Workflow file for this run

name: test
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubicloud-standard-2-arm, macos-13]
postgres: [11, 12, 13, 14, 15, 16]
steps:
- uses: actions/checkout@v4
with:
# fetch-depth ensures all tags are present on the repo so we can run update tests successfully
fetch-depth: 0
submodules: "recursive"
- name: Build
id: build
run: sudo sh -c "PG_VERSION=$PG_VERSION USE_SOURCE=1 GITHUB_OUTPUT=$GITHUB_OUTPUT ENABLE_COVERAGE=$ENABLE_COVERAGE ./ci/scripts/build.sh"
env:
PG_VERSION: ${{ matrix.postgres }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
ENABLE_COVERAGE: ${{ (startsWith(matrix.os, 'ubuntu') && matrix.postgres == 15) && '1' || '0' }}
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Run tests linux
id: test-linux
run: sudo su postgres -c "PG_VERSION=$PG_VERSION RUN_REPLICA_TESTS=$RUN_REPLICA_TESTS ENABLE_COVERAGE=$ENABLE_COVERAGE ./ci/scripts/run-tests-linux.sh"
env:
RUN_REPLICA_TESTS: "${{ matrix.postgres == 15 && '1' || '0' }}"
PG_VERSION: ${{ matrix.postgres }}
ENABLE_COVERAGE: ${{ (startsWith(matrix.os, 'ubuntu') && matrix.postgres == 15) && '1' || '0' }}
if: ${{ !startsWith(matrix.os, 'mac') }}
- name: Run update tests linux
id: update-test-linux
# We fix some flaky tests in new versions but those keep failing in the version before, resulting
# in CI failures. This prevents it: TODO: 0.4.0+ remove this
continue-on-error: true
run: |
sudo pip install GitPython &&\
# Start postgres
sudo su postgres -c "PG_VERSION=$PG_VERSION RUN_TESTS=0 ./ci/scripts/run-tests-linux.sh" && \
sudo su -c "PG_VERSION=$PG_VERSION python3 ./scripts/test_updates.py -U postgres" &&\
echo "Done with updates"
env:
PG_VERSION: ${{ matrix.postgres }}
if: ${{ !startsWith(matrix.os, 'mac') }}
- name: Write a comment if the update tests failied above
if: ${{ !startsWith(matrix.os, 'mac') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ ${{ steps.update-test-linux.outcome }} != 'success' ]; then
echo "Update tests failed. Posting a comment to the PR/commit..."
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
if [ "$PR_NUMBER" != "null" ]; then
gh pr comment "$PR_NUMBER" --body "The update tests on Linux failed. Please check the logs for more details."
else
echo "Could not determine PR number. Skipping comment."
fi
fi
- name: Run tests mac
id: test-mac
run: ./ci/scripts/run-tests-mac.sh
env:
PG_VERSION: ${{ matrix.postgres }}
# postgresql@11 seems broken on brew on Ventura used in the runner https://github.com/orgs/Homebrew/discussions/5263
if: ${{ startsWith(matrix.os, 'mac') && matrix.postgres != 11 }}
- name: Upload Postgres logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: postgres-server-${{ matrix.os }}-${{ matrix.postgres }}-logs
path: |
/tmp/pg-out.log
/tmp/pg-error.log
- name: Upload to codecov
uses: codecov/codecov-action@v4
env:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ env.codecov_token != '' && startsWith(matrix.os, 'ubuntu') && matrix.postgres == 15 }} # for now run only on once
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-lanterndb
fail_ci_if_error: true
directory: /tmp/lantern/build/
file: ./coverage.info
- name: Check clang formatting
run: "cd /tmp/lantern/build && make format_check"