Skip to content

Commit a8fe82c

Browse files
committed
Add github workflow to build and test postgres-v17 with sanitizers
1 parent 957770f commit a8fe82c

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Build and Test with Sanitizers
2+
3+
on:
4+
push:
5+
branches:
6+
- "enable-sanitizers-for-v17"
7+
workflow_dispatch:
8+
9+
defaults:
10+
run:
11+
shell: bash -euxo pipefail {0}
12+
13+
concurrency:
14+
# Allow only one workflow per any non-`main` branch.
15+
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
16+
cancel-in-progress: true
17+
18+
env:
19+
RUST_BACKTRACE: 1
20+
COPT: '-Werror'
21+
# A concurrency group that we use for e2e-tests runs, matches `concurrency.group` above with `github.repository` as a prefix
22+
E2E_CONCURRENCY_GROUP: ${{ github.repository }}-e2e-tests-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
23+
24+
jobs:
25+
check-permissions:
26+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'run-no-ci') }}
27+
uses: ./.github/workflows/check-permissions.yml
28+
with:
29+
github-event-name: ${{ github.event_name }}
30+
31+
cancel-previous-e2e-tests:
32+
needs: [ check-permissions ]
33+
if: github.event_name == 'pull_request'
34+
runs-on: ubuntu-22.04
35+
36+
steps:
37+
- name: Cancel previous e2e-tests runs for this PR
38+
env:
39+
GH_TOKEN: ${{ secrets.CI_ACCESS_TOKEN }}
40+
run: |
41+
gh workflow --repo neondatabase/cloud \
42+
run cancel-previous-in-concurrency-group.yml \
43+
--field concurrency_group="${{ env.E2E_CONCURRENCY_GROUP }}"
44+
45+
tag:
46+
needs: [ check-permissions ]
47+
runs-on: [ self-hosted, small ]
48+
container: 369495373322.dkr.ecr.eu-central-1.amazonaws.com/base:pinned
49+
outputs:
50+
build-tag: ${{steps.build-tag.outputs.tag}}
51+
52+
steps:
53+
# Need `fetch-depth: 0` to count the number of commits in the branch
54+
- uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
58+
- name: Get build tag
59+
run: |
60+
echo run:$GITHUB_RUN_ID
61+
echo ref:$GITHUB_REF_NAME
62+
echo rev:$(git rev-list --count HEAD)
63+
if [[ "$GITHUB_REF_NAME" == "main" ]]; then
64+
echo "tag=$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT
65+
elif [[ "$GITHUB_REF_NAME" == "release" ]]; then
66+
echo "tag=release-$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT
67+
elif [[ "$GITHUB_REF_NAME" == "release-proxy" ]]; then
68+
echo "tag=release-proxy-$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT
69+
elif [[ "$GITHUB_REF_NAME" == "release-compute" ]]; then
70+
echo "tag=release-compute-$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT
71+
else
72+
echo "GITHUB_REF_NAME (value '$GITHUB_REF_NAME') is not set to either 'main' or 'release', 'release-proxy', 'release-compute'"
73+
echo "tag=$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
74+
fi
75+
shell: bash
76+
id: build-tag
77+
78+
build-build-tools-image:
79+
needs: [ check-permissions ]
80+
uses: ./.github/workflows/build-build-tools-image.yml
81+
secrets: inherit
82+
83+
build-and-test-locally:
84+
needs: [ tag, build-build-tools-image ]
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
arch: [ x64, arm64 ]
89+
# Do not build or run tests in debug for release branches
90+
build-type: [ release-with-sanitizers ]
91+
uses: ./.github/workflows/_build-and-test-locally.yml
92+
with:
93+
arch: ${{ matrix.arch }}
94+
build-tools-image: ${{ needs.build-build-tools-image.outputs.image }}-bookworm
95+
build-tag: ${{ needs.tag.outputs.build-tag }}
96+
build-type: ${{ matrix.build-type }}
97+
# Run tests on the latest Postgres version in debug builds.
98+
test-cfg: '[{"pg_version":"v17", "lfc_state": "with-lfc"}]'
99+
secrets: inherit
100+
101+
102+
create-test-report:
103+
needs: [ check-permissions, build-and-test-locally, build-build-tools-image ]
104+
if: ${{ !cancelled() && contains(fromJSON('["skipped", "success"]'), needs.check-permissions.result) }}
105+
permissions:
106+
id-token: write # aws-actions/configure-aws-credentials
107+
statuses: write
108+
contents: write
109+
pull-requests: write
110+
outputs:
111+
report-url: ${{ steps.create-allure-report.outputs.report-url }}
112+
113+
runs-on: [ self-hosted, small ]
114+
container:
115+
image: ${{ needs.build-build-tools-image.outputs.image }}-bookworm
116+
credentials:
117+
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
118+
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
119+
options: --init
120+
121+
steps:
122+
- uses: actions/checkout@v4
123+
124+
- name: Create Allure report
125+
if: ${{ !cancelled() }}
126+
id: create-allure-report
127+
uses: ./.github/actions/allure-report-generate
128+
with:
129+
store-test-results-into-db: true
130+
aws-oicd-role-arn: ${{ vars.DEV_AWS_OIDC_ROLE_ARN }}
131+
env:
132+
REGRESS_TEST_RESULT_CONNSTR_NEW: ${{ secrets.REGRESS_TEST_RESULT_CONNSTR_NEW }}
133+
134+
- uses: actions/github-script@v7
135+
if: ${{ !cancelled() }}
136+
with:
137+
# Retry script for 5XX server errors: https://github.com/actions/github-script#retries
138+
retries: 5
139+
script: |
140+
const report = {
141+
reportUrl: "${{ steps.create-allure-report.outputs.report-url }}",
142+
reportJsonUrl: "${{ steps.create-allure-report.outputs.report-json-url }}",
143+
}
144+
145+
const coverage = {
146+
}
147+
148+
const script = require("./scripts/comment-test-report.js")
149+
await script({
150+
github,
151+
context,
152+
fetch,
153+
report,
154+
coverage,
155+
})

0 commit comments

Comments
 (0)