Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 25dfdb6

Browse files
authored
Merge pull request #266 for release 0.5.0 from develop into master
Merge release 0.5.0 into master
2 parents ee185a3 + 172faba commit 25dfdb6

File tree

121 files changed

+18040
-1464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+18040
-1464
lines changed

.cargo/config

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto-generated by pgx. You may edit this, or delete it to have a new one created.
2+
3+
[target.x86_64-unknown-linux-gnu]
4+
linker = ".cargo/pgx-linker-script.sh"
5+
6+
[target.aarch64-unknown-linux-gnu]
7+
linker = ".cargo/pgx-linker-script.sh"
8+
9+
[target.x86_64-unknown-linux-musl]
10+
linker = ".cargo/pgx-linker-script.sh"
11+
12+
[target.aarch64-unknown-linux-musl]
13+
linker = ".cargo/pgx-linker-script.sh"
14+
15+
[target.x86_64-apple-darwin]
16+
linker = ".cargo/pgx-linker-script.sh"
17+
18+
[target.aarch64-apple-darwin]
19+
linker = ".cargo/pgx-linker-script.sh"
20+
21+
[target.x86_64-unknown-freebsd]
22+
linker = ".cargo/pgx-linker-script.sh"

.cargo/pgx-linker-script.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /usr/bin/env bash
2+
# Auto-generated by pgx. You may edit this, or delete it to have a new one created.
3+
4+
if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then
5+
UNAME=$(uname)
6+
if [[ $UNAME == "Darwin" ]]; then
7+
TEMP=$(mktemp pgx-XXX)
8+
echo "*_pgx_internals_*" > ${TEMP}
9+
gcc -exported_symbols_list ${TEMP} $@
10+
rm -rf ${TEMP}
11+
else
12+
TEMP=$(mktemp pgx-XXX)
13+
echo "{ __pgx_internals_*; };" > ${TEMP}
14+
gcc -Wl,-dynamic-list=${TEMP} $@
15+
rm -rf ${TEMP}
16+
fi
17+
else
18+
gcc -Wl,-undefined,dynamic_lookup $@
19+
fi

.dockerignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.git/
2+
.github/
3+
dist/*.rpm
4+
dist/*.deb
5+
dist/*.tar
6+
target/
7+
*/target/
8+
*.md
9+
!CHANGELOG.md
10+
LICENSE
11+
NOTICE

.github/workflows/ci.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: ci
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- '.github/workflows/release.yaml'
6+
- '*.md'
7+
- 'dist/*'
8+
- 'tools/package'
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
postgres:
16+
- version: "14"
17+
- version: "13"
18+
- version: "12"
19+
env:
20+
RUSTC_WRAPPER: sccache
21+
SCCACHE_BUCKET: promscale-extension-sccache
22+
AWS_ACCESS_KEY_ID: ${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_ACCESS_KEY_ID }}
23+
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_SECRET_ACCESS_KEY }}
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Install latest nightly
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: stable
30+
override: true
31+
32+
- name: Setup sccache
33+
run: |
34+
curl -L "https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz" | tar zxf -
35+
chmod +x sccache-*/sccache
36+
sudo mv sccache-*/sccache /usr/local/bin/sccache
37+
sccache --show-stats
38+
39+
- uses: Swatinem/rust-cache@v1
40+
41+
- name: Install cargo-pgx
42+
uses: actions-rs/cargo@v1
43+
with:
44+
command: install
45+
args: cargo-pgx --git https://github.com/timescale/pgx --branch promscale-staging
46+
47+
- name: Cache pgx
48+
id: cache-pgx
49+
uses: actions/cache@v2
50+
with:
51+
path: ~/.pgx
52+
key: dot-pgx-${{ matrix.postgres.version }}-cargo-${{ hashFiles('**/Cargo.*') }}
53+
54+
- name: Initialize pgx
55+
if: ${{ steps.cache-pgx.outputs.cache-hit != 'true' }}
56+
uses: actions-rs/cargo@v1
57+
with:
58+
command: pgx
59+
args: init --pg${{ matrix.postgres.version }} download
60+
61+
- name: Run cargo test
62+
uses: actions-rs/cargo@v1
63+
with:
64+
command: pgx
65+
args: test pg${{ matrix.postgres.version }}
66+
67+
- name: Show sccache stats
68+
run: sccache --show-stats
69+

.github/workflows/docker.yaml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: docker
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- '.github/workflows/release.yaml'
6+
- 'dist/*'
7+
- 'tools/*'
8+
push:
9+
branches:
10+
- develop
11+
- master
12+
tags:
13+
- "*"
14+
15+
jobs:
16+
docker:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
pgversion:
21+
- 14
22+
- 13
23+
- 12
24+
tsversion:
25+
- 2.6.1
26+
base:
27+
- ha
28+
- alpine
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v1
34+
35+
- name: Login to GitHub Container Registry
36+
uses: docker/login-action@v1
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Gather metadata
43+
id: metadata
44+
run: |
45+
tsmajor=$(echo ${{ matrix.tsversion }} | cut -d. -f1)
46+
tsmajmin=$(echo ${{ matrix.tsversion }} | cut -d. -f1,2)
47+
branch_name=$(echo ${{github.head_ref || github.ref_name}} | sed 's#/#-#')
48+
build_type_suffix=$(echo "-${{matrix.base}}" | sed 's/-ha//')
49+
echo "::set-output name=tsmajor::${tsmajor}"
50+
echo "::set-output name=tsmajmin::${tsmajmin}"
51+
echo "::set-output name=branch_name::${branch_name}"
52+
echo "::set-output name=build_type_suffix::${build_type_suffix}"
53+
54+
- name: Build and push
55+
uses: docker/build-push-action@v2
56+
with:
57+
build-args: |
58+
PG_VERSION=${{ matrix.pgversion }}
59+
TIMESCALEDB_VERSION_FULL=${{ matrix.tsversion }}
60+
TIMESCALEDB_VERSION_MAJOR=${{ steps.metadata.outputs.tsmajor }}
61+
TIMESCALEDB_VERSION_MAJMIN=${{ steps.metadata.outputs.tsmajmin }}
62+
secrets: |
63+
"AWS_ACCESS_KEY_ID=${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_ACCESS_KEY_ID }}"
64+
"AWS_SECRET_ACCESS_KEY=${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_SECRET_ACCESS_KEY }}"
65+
context: .
66+
file: ${{matrix.base}}.Dockerfile
67+
push: true
68+
tags: |
69+
ghcr.io/timescale/dev_promscale_extension:${{steps.metadata.outputs.branch_name}}-ts${{matrix.tsversion}}-pg${{matrix.pgversion}}${{steps.metadata.outputs.build_type_suffix}}
70+
ghcr.io/timescale/dev_promscale_extension:${{steps.metadata.outputs.branch_name}}-ts${{steps.metadata.outputs.tsmajor}}-pg${{matrix.pgversion}}${{steps.metadata.outputs.build_type_suffix}}
71+
ghcr.io/timescale/dev_promscale_extension:${{steps.metadata.outputs.branch_name}}-ts${{steps.metadata.outputs.tsmajmin}}-pg${{matrix.pgversion}}${{steps.metadata.outputs.build_type_suffix}}
72+
# Note: it's necessary to use a different cache scope to achieve caching for both Ubuntu and Alpine images
73+
cache-from: type=gha,scope=${{matrix.base}}-${{matrix.pgversion}}-${{matrix.tsversion}}
74+
cache-to: type=gha,mode=max,scope=${{matrix.base}}-${{matrix.pgversion}}-${{matrix.tsversion}}
75+
76+
- name: Run end-to-end tests
77+
uses: actions-rs/cargo@v1
78+
with:
79+
command: test
80+
args: -p e2e
81+
env:
82+
TS_DOCKER_IMAGE: ghcr.io/timescale/dev_promscale_extension:${{steps.metadata.outputs.branch_name}}-ts${{matrix.tsversion}}-pg${{matrix.pgversion}}${{steps.metadata.outputs.build_type_suffix}}
83+
84+
# This allows us to set a single job which must pass in GitHub's branch protection rules,
85+
# otherwise we have to keep updating them as we add or remove postgres versions etc.
86+
docker-result:
87+
name: docker result
88+
if: always()
89+
needs:
90+
- docker
91+
runs-on: ubuntu-latest
92+
steps:
93+
- name: Mark the job as a success
94+
if: needs.docker.result == 'success'
95+
run: exit 0
96+
- name: Mark the job as a failure
97+
if: needs.docker.result != 'success'
98+
run: exit 1

.github/workflows/lint.yaml

+76-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: lint
22
on:
33
pull_request:
4+
paths-ignore:
5+
- '.github/workflows/release.yaml'
6+
- 'dist/*'
7+
- 'tools/package'
8+
- '*.md'
49

510
jobs:
611
fmt:
@@ -22,6 +27,11 @@ jobs:
2227

2328
clippy:
2429
runs-on: ubuntu-latest
30+
env:
31+
RUSTC_WRAPPER: sccache
32+
SCCACHE_BUCKET: promscale-extension-sccache
33+
AWS_ACCESS_KEY_ID: ${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_ACCESS_KEY_ID }}
34+
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_SECRET_ACCESS_KEY }}
2535
steps:
2636
- uses: actions/checkout@v2
2737
- name: Install latest nightly
@@ -31,13 +41,20 @@ jobs:
3141
override: true
3242
components: rustfmt, clippy
3343

44+
- name: Setup sccache
45+
run: |
46+
curl -L "https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz" | tar zxf -
47+
chmod +x sccache-*/sccache
48+
sudo mv sccache-*/sccache /usr/local/bin/sccache
49+
sccache --show-stats
50+
3451
- uses: Swatinem/rust-cache@v1
3552

3653
- name: Install cargo-pgx
3754
uses: actions-rs/cargo@v1
3855
with:
3956
command: install
40-
args: cargo-pgx
57+
args: cargo-pgx --git https://github.com/timescale/pgx --branch promscale-staging
4158

4259
- name: Initialize pgx
4360
uses: actions-rs/cargo@v1
@@ -51,3 +68,61 @@ jobs:
5168
command: clippy
5269
args: --features pg14 -- -D warnings
5370

71+
pgspot:
72+
runs-on: ubuntu-latest
73+
env:
74+
RUSTC_WRAPPER: sccache
75+
SCCACHE_BUCKET: promscale-extension-sccache
76+
AWS_ACCESS_KEY_ID: ${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_ACCESS_KEY_ID }}
77+
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROMSCALE_EXTENSION_SCCACHE_AWS_SECRET_ACCESS_KEY }}
78+
steps:
79+
- name: Checkout extension code
80+
uses: actions/checkout@v2
81+
82+
- name: Setup python 3.10
83+
uses: actions/setup-python@v2
84+
with:
85+
python-version: '3.10'
86+
87+
- name: Checkout pgspot
88+
uses: actions/checkout@v2
89+
with:
90+
repository: 'timescale/pgspot'
91+
ref: '0.2.0'
92+
path: 'pgspot'
93+
94+
- name: Install pgspot dependencies
95+
run: python -m pip install -r pgspot/requirements.txt
96+
97+
- name: Setup sccache
98+
run: |
99+
curl -L "https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz" | tar zxf -
100+
chmod +x sccache-*/sccache
101+
sudo mv sccache-*/sccache /usr/local/bin/sccache
102+
sccache --show-stats
103+
104+
- uses: Swatinem/rust-cache@v1
105+
106+
- name: Install cargo-pgx
107+
uses: actions-rs/cargo@v1
108+
with:
109+
command: install
110+
args: cargo-pgx --git https://github.com/timescale/pgx --branch promscale-staging
111+
112+
- name: Initialize pgx
113+
uses: actions-rs/cargo@v1
114+
with:
115+
command: pgx
116+
args: init --pg14 download
117+
118+
- name: Prepare control file
119+
run: make promscale.control
120+
121+
- name: Generate schema
122+
uses: actions-rs/cargo@v1
123+
with:
124+
command: pgx
125+
args: schema pg14 --out /tmp/schema.sql
126+
127+
- name: Run pgspot
128+
run: ./pgspot/pgspot --sql-accepting=execute_everywhere --sql-accepting=distributed_exec --ignore PS005 /tmp/schema.sql ./sql/promscale--0.0.0.sql

0 commit comments

Comments
 (0)