forked from omnigres/omnigres
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (132 loc) · 5.77 KB
/
build.yml
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Build
on:
push:
# one can merge their branch to test-gh-workflows for testing changes of current workflow before merging them to master
branches: [ "master", "test-gh-workflows" ]
pull_request_target:
branches: [ "master", "next/*" ]
schedule:
- cron: '33 13 * * *'
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules
# Advises omni_containers where Docker is
DOCKER_HOST: ci-docker:2375
# Advises tests as to where the Docker host is
DOCKER_CI_HOST: ci-docker
jobs:
approve:
runs-on: ubuntu-latest
steps:
- name: Approve
run: echo For security reasons, all pull requests need to be approved first before running any automated CI.
build:
strategy:
matrix:
# pgver: [ 17, 16, 15, 14, 13 ]
pgver: [17]
os: [ macos-14, warp-macos-14-arm64-6x, warpdev-macos-14-arm64-3x ]
build_type: [Debug, Release]
exclude:
- os: macos-14
pgver: 16
- os: macos-14
pgver: 15
- os: macos-14
pgver: 14
- os: macos-14
pgver: 13
- os: macos-14
pgver: 12
- os: macos-14
pgver: 11
fail-fast: false
needs: [ approve ] # Require the first step to finish
environment: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || contains(fromJSON(vars.AUTO_APPROVED_CONTRIBUTORS), github.event.pull_request.user.login) || contains(fromJSON('["OWNER", "MEMBER"]'), github.event.pull_request.author_association)) && 'master' || 'Integrate Pull Request' }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- run: |
echo "Author association: ${{ github.event.pull_request.author_association }}"
- uses: actions/checkout@v3
if: github.event_name == 'push'
- uses: actions/checkout@v3
if: github.event_name != 'push'
with:
ref: ${{ github.event.pull_request.head.sha }}
# This is done to address the problem on macOS where .pg built in a directory of one
# GitHub Action runner won't work when restored in another one since dylds have install_name pointing
# to the original location. We include the hash of their path into the cache name.
- name: Get path hash
if: matrix.os == 'macos'
run: |
echo "PATH_SUFFIX=-$(pwd | sha256sum | awk '{print $1}')" >> $GITHUB_ENV
# On other systems, make it explicitly empty
- name: Get path hash
if: matrix.os != 'macos'
run: |
echo "PATH_SUFFIX=" >> $GITHUB_ENV
- uses: WarpBuilds/cache@v1
with:
path: .pg
key: ${{ matrix.os }}-pg-${{ matrix.pgver }}-${{ matrix.build_type }}-${{ hashFiles('cmake/FindPostgreSQL.cmake') }}${{ env.PATH_SUFFIX }}
- uses: WarpBuilds/cache@v1
with:
path: ${{github.workspace}}/build/_deps
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('extensions/**/CMakeLists.txt', '*/CMakeLists.txt', 'cmake/*.cmake') }}
- name: Tailscale
uses: Warpbuilds/tailscale-github-action@edd5af71746bf5fac8654fa4b41f30da57c5858a #tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
version: 1.68.2
- name: Configure
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DPGVER=${{ matrix.pgver }}
- name: Build
run: cmake --build ${{github.workspace}}/build --parallel --config ${{matrix.build_type}}
- name: Setup debug session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 120
- name: Test
working-directory: ${{github.workspace}}/build
run: TMPDIR=$RUNNER_TEMP DOCKER_HOST_IP=$(tailscale ip -4) USER=$(whoami) ctest --timeout 1000 --force-new-ctest-process --repeat until-pass:10 --output-on-failure -j $(nproc) -C ${{matrix.build_type}}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.pgver }}-regression.diffs
path: ${{ github.workspace }}/build/extensions/**/regression.diffs
- name: Print error-related artifacts
if: failure()
run: |
echo "- diffs: "
find ${{github.workspace}}/build -name \*.diffs -exec echo "=== {}:" \; -exec cat {} \;
echo "- postmaster.log: "
find ${{github.workspace}}/build -name postmaster.log -exec echo "=== {}:" \; -exec cat {} \;
echo "- initdb.log: "
find ${{github.workspace}}/build -name initdb.log -exec echo "=== {}:" \; -exec cat {} \;
# Ensure it can be built against externally-supplied Postgres
build-external-pg:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v3
- name: Install necessary dependencies
run: |
sudo apt-get update
sudo apt-get remove -f postgresql-14
sudo apt-get install -f postgresql-server-dev-14 postgresql-14 postgresql-plpython3-14
- name: Configure
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DPG_CONFIG=$(which pg_config)
- name: Build
run: cmake --build ${{github.workspace}}/build --parallel --config Release --target all --target package_extensions
# Ensure every extension can be built independently
build-extensions-independently:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v3
- uses: WarpBuilds/cache@v1
with:
path: .pg
key: ${{ matrix.os }}-pg-${{ matrix.pgver }}-${{ hashFiles('cmake/FindPostgreSQL.cmake') }}
- run: ci/build-extensions-separately