-
Notifications
You must be signed in to change notification settings - Fork 59
150 lines (145 loc) · 6.53 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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 without SSL
id: build_without_ssl
run: sudo sh -c "USE_SSL=0 PG_VERSION=$PG_VERSION USE_SOURCE=1 GITHUB_OUTPUT=$GITHUB_OUTPUT INSTALL_CLI=1 ENABLE_FAILURE_POINTS=1 ./ci/scripts/build.sh"
env:
PG_VERSION: ${{ matrix.postgres }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# 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 without SSL
id: test-linux-without-ssl
run: sudo su postgres -c "PG_VERSION=$PG_VERSION ./ci/scripts/run-tests-linux.sh"
env:
PG_VERSION: ${{ matrix.postgres }}
if: ${{ !startsWith(matrix.os, 'mac') }}
- name: Run integration tests linux without SSL
id: integration-test-linux-without-ssl
run: |
# pytest tries to open files with full path and so 'work' home folder must be listable by postgres for it to work
sudo chmod +x /home/runner && \
sudo su postgres -c "LANTERN_CLI_PATH=${{ env.LANTERN_CLI_PATH }} USE_SSL=0 /tmp/lantern/cienv/bin/python ./scripts/integration_tests.py -k external_index" &&\
echo "Done with integration tests"
env:
PG_VERSION: ${{ matrix.postgres }}
if: ${{ !startsWith(matrix.os, 'mac') }}
- name: Build
id: build
run: sudo sh -c "USE_SSL=1 PG_VERSION=$PG_VERSION USE_SOURCE=1 GITHUB_OUTPUT=$GITHUB_OUTPUT ENABLE_COVERAGE=$ENABLE_COVERAGE ENABLE_FAILURE_POINTS=1 ./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' }}
- name: Run tests linux
id: test-linux
run: sudo su postgres -c "PG_VERSION=$PG_VERSION ./ci/scripts/run-tests-linux.sh"
env:
PG_VERSION: ${{ matrix.postgres }}
ENABLE_COVERAGE: ${{ (startsWith(matrix.os, 'ubuntu') && matrix.postgres == 15) && '1' || '0' }}
if: ${{ !startsWith(matrix.os, 'mac') }}
# integration tests
- name: Set LANTERN_CLI_PATH variable
run: echo "LANTERN_CLI_PATH=/tmp/bin/lantern-cli" >> $GITHUB_ENV
if: ${{ !startsWith(matrix.os, 'mac') }}
- name: Run integration tests linux
id: integration-test-linux
run: |
# pytest tries to open files with full path and so 'work' home folder must be listable by postgres for it to work
sudo fuser -k 8998/tcp || true 2>/dev/null # kill previously started cli
sudo chmod +x /home/runner && \
sudo su postgres -c "LANTERN_CLI_PATH=${{ env.LANTERN_CLI_PATH }} USE_SSL=1 /tmp/lantern/cienv/bin/python ./scripts/integration_tests.py" &&\
echo "Done with integration tests"
env:
PG_VERSION: ${{ matrix.postgres }}
if: ${{ !startsWith(matrix.os, 'mac') }}
- name: Collect coverage files
id: collect-cov-files
run: sudo su postgres -c "cd /tmp/lantern/build && make cover"
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.postgres == 15 }}
- name: Run update tests linux
id: update-test-linux
run: |
# 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 /tmp/lantern/cienv/bin/python ./scripts/test_updates.py -U postgres" &&\
echo "Done with updates"
env:
PG_VERSION: ${{ matrix.postgres }}
if: ${{ !startsWith(matrix.os, 'mac') }}
- name: Run catalog update checks
id: catalog-update-test-linux
run: |
sudo su postgres -c "PG_VERSION=$PG_VERSION RUN_TESTS=0 ./ci/scripts/run-tests-linux.sh" && \
sudo su -c "PG_VERSION=$PG_VERSION DATABASE_URL='postgresql://postgres@localhost:5432/postgres' ruby ./scripts/test_updates/main.rb test lantern" &&\
echo "Done catalog update checks"
env:
PG_VERSION: ${{ matrix.postgres }}
if: ${{ !startsWith(matrix.os, 'mac') }}
- 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: Run integration tests mac
id: integration-test-mac
run: |
PATH="/usr/local/opt/postgresql@${PG_VERSION}/bin:$PATH" /tmp/lantern/cienv/bin/python ./scripts/integration_tests.py &&\
echo "Done with integration tests"
env:
PG_VERSION: ${{ matrix.postgres }}
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"