-
Notifications
You must be signed in to change notification settings - Fork 47
191 lines (177 loc) · 8.07 KB
/
ci.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: CI
on:
pull_request:
push:
branches:
- main
- staging
- trying
schedule:
# TimescaleDB integration: 8am UTC, 3am Eastern, midnight Pacific
- cron: '0 8 * * 1-4'
# Testing on every platform: 6am UTC, 1am Eastern, 10pm Pacific
- cron: '0 6 * * 1-4'
workflow_dispatch:
inputs:
container-image:
description: 'Container image to pull from DockerHub'
required: false
tsdb-commit:
description: 'TimescaleDB commit to use'
default: ''
required: false
tsdb-repo:
description: 'TimescaleDB repo to use'
default: 'https://github.com/timescale/timescaledb.git'
required: false
all-platforms:
description: 'Test all platforms'
type: boolean
default: false
jobs:
testpostgres:
name: Test Postgres
runs-on: ubuntu-20.04
container:
image: ${{ inputs.container-image || 'timescaledev/toolkit-builder-test' }}:${{ matrix.container.image }}
strategy:
fail-fast: false
max-parallel: 12
matrix:
pgversion: [14, 15, 16, 17]
container:
- os: rockylinux
version: "9"
image: rockylinux-9-x86_64
# Building TSDB in CI is only supported on Debian/Ubuntu
skip: ${{ inputs.tsdb-commit != '' }}
schedule: ${{ !(github.event_name == 'schedule' && github.event.schedule == '0 8 * * 1-4') }}
- os: debian
version: "11"
image: debian-11-amd64
schedule: true
- os: debian
version: "10"
image: debian-10-amd64
schedule: ${{ inputs.all-platforms || ( github.event_name == 'schedule' && github.event.schedule == '0 6 * * 1-4' ) }}
- os: ubuntu
version: "20.04"
image: ubuntu-20.04-amd64
schedule: ${{ inputs.all-platforms || ( github.event_name == 'schedule' && github.event.schedule == '0 6 * * 1-4' ) }}
- os: ubuntu
version: "22.04"
image: ubuntu-22.04-amd64
schedule: ${{ inputs.all-platforms || ( github.event_name == 'schedule' && github.event.schedule == '0 6 * * 1-4' ) }}
exclude:
- container:
skip: true
- container:
schedule: false
include:
# TimescaleDB as of 2.12.0 no longer supports PostgreSQL 12.
# To allow us to do run CI against PostgreSQL 12, we therefore explicitly
# remove all CI's, except if we are run against the latest supported TimescaleDB
# version for PostgreSQL 12, which is 2.11.2
- pgversion: 12
container:
image: debian-11-amd64
os: debian
version: "11"
tsdb_commit: 2.11.2
# TimescaleDB as of 2.16.0 no longer supports PostgreSQL 13.
# To allow us to do run CI against PostgreSQL 13, we therefore explicitly
# remove all CI's, except if we are run against the latest supported TimescaleDB
# version for PostgreSQL 13, which is 2.15.3
- pgversion: 13
container:
image: debian-11-amd64
os: debian
version: "11"
tsdb_commit: 2.15.3
env:
# TODO Why? Cargo default is to pass `-C incremental` to rustc; why don't we want that?
# https://doc.rust-lang.org/rustc/codegen-options/index.html#incremental
# Well turning it off takes the extension target size down from 3G to 2G...
CARGO_INCREMENTAL: 0
# TODO Why? If we're concerned about trouble fetching crates, why not
# just fetch them once at the time we select a dependency?
# Errors fetching crates are probably rare enough that we don't see the
# need to bother, but then why not just let the build fail?
CARGO_NET_RETRY: 10
# TODO What reads this? It's not listed on
# https://doc.rust-lang.org/cargo/reference/environment-variables.html
CI: 1
RUST_BACKTRACE: short
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
# Github Actions provides a bind mounted working directory for us, where
# the above checkout happens, and where caches are read from and restored
# to, and it's all owned by 1001. Our container image is `USER root` so
# we have no problem writing anywhere, but we run some things as user
# 'postgres', which used to be user 1000 but is now 1001. Hoping in the
# future to make our container image `USER postgres` and further simplify
# this file and the packaging Actions file, but it's non-trivial.
- name: chown Repository
run: chown -R postgres .
- name: Build and install TimescaleDB
if: ${{ (github.event_name == 'schedule' && github.event.schedule == '0 8 * * 1-4') || inputs.tsdb-commit != '' }}
run: ./tools/install-timescaledb '${{ matrix.pgversion }}' '${{ inputs.tsdb-repo || 'https://github.com/timescale/timescaledb.git' }}' '${{ inputs.tsdb-commit == '' && 'main' || matrix.tsdb_commit || inputs.tsdb-commit }}'
# TODO After the container image contains a primed target dir, is this still worth it?
# Only possible advantage is this one is per-pg-version but what's the impact?
- name: Cache cargo target dir
uses: actions/cache@v3
if: ${{ matrix.container.image == 'debian-11-amd64' }}
with:
path: target
key: ${{ runner.os }}-test-pg${{ matrix.pgversion }}-target-${{ hashFiles('Cargo.lock', '.github/workflows/ci.yml') }}
restore-keys: ${{ runner.os }}-test-pg${{ matrix.pgversion }}-target-
- name: Run pgrx tests
run: |
if [ "${{ matrix.container.version }}" = 7 ]; then
# needed for pgrx to find clang
set +e # will succeed but have non-zero exit code
. scl_source enable llvm-toolset-7
set -e
fi
su postgres -c 'sh tools/build -pg${{ matrix.pgversion }} test-extension 2>&1'
- name: Run doc tests
# depends on TSDB, which requires PG >=13
if: ${{ matrix.pgversion >= 13 && (matrix.pgversion >= 13 && (matrix.pgversion <= 15 || ((github.event_name == 'schedule' && github.event.schedule == '0 8 * * 1-4') || inputs.tsdb-commit != ''))) }}
run: su postgres -c 'sh tools/build -pg${{ matrix.pgversion }} test-doc 2>&1'
- name: Run binary update tests (deb)
# depends on TSDB, which requires PG >=13
if: ${{ (matrix.container.os == 'debian' || matrix.container.os == 'ubuntu') && (matrix.pgversion >= 13 && (matrix.pgversion <= 16 || ((github.event_name == 'schedule' && github.event.schedule == '0 8 * * 1-4') || inputs.tsdb-commit != ''))) }}
run: |
su postgres -c 'OS_NAME=${{ matrix.container.os }} OS_VERSION=${{ matrix.container.version }} tools/testbin -version no -bindir / -pgversions ${{ matrix.pgversion }} ci 2>&1'
- name: Run binary update tests (EL)
if: ${{ (matrix.container.os == 'rockylinux') && matrix.container.version != '9' && (matrix.pgversion >= 13 && (matrix.pgversion <= 16 || ((github.event_name == 'schedule' && github.event.schedule == '0 8 * * 1-4') || inputs.tsdb-commit != ''))) }}
run: |
su postgres -c 'OS_NAME=${{ matrix.container.os }} OS_VERSION=${{ matrix.container.version }} tools/testbin -version no -bindir / -pgversions ${{ matrix.pgversion }} rpm_ci 2>&1'
testcrates:
name: Test Crates
runs-on: ubuntu-20.04
container:
image: ${{ inputs.container-image || 'timescaledev/toolkit-builder' }}:debian-11-amd64
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CI: 1
RUST_BACKTRACE: short
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: chown Repository
run: chown -R postgres .
- name: Cache cargo target dir
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-test-crates-target-${{ hashFiles('Cargo.lock', '.github/workflows/ci.yml') }}
restore-keys: ${{ runner.os }}-test-crates-target-
- name: Run Crates Tests
run: su postgres -c 'sh tools/build test-crates 2>&1'