Skip to content

Commit

Permalink
use git sha for postgres build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
wuputah committed Sep 27, 2024
1 parent f6bf518 commit 50d772f
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ jobs:
run: ruff check --output-format=github .
- name: Run ruff format
run: ruff format --diff

build-and-test:
name: 'Build and test'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-24.04]
version: [REL_16_STABLE, REL_17_STABLE]
runs-on: ${{ matrix.os }}

Expand All @@ -66,7 +67,7 @@ jobs:
sudo apt-get update -qq
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev \
libssl-dev libxml2-utils xsltproc pkg-config libc++-dev libc++abi-dev libglib2.0-dev libtinfo5 cmake \
libssl-dev libxml2-utils xsltproc pkg-config libc++-dev libc++abi-dev libglib2.0-dev libtinfo6 cmake \
libstdc++-12-dev
echo "${PWD}/postgres/inst/bin:$PATH'" > $GITHUB_PATH
Expand All @@ -81,26 +82,34 @@ jobs:
submodules: 'recursive'
path: duckdb

- name: Compute DuckDB SHA
- name: Checkout PostgreSQL code
run: |
rm -rf postgres
git clone --branch ${{ matrix.version }} --single-branch --depth 1 https://github.com/postgres/postgres.git
- name: Compute Version SHAs
id: versions
run: |
pushd duckdb
DUCKDB_SHA=`git ls-tree HEAD third_party/duckdb --format='%(objectname)'`
echo "duckdb_sha=${DUCKDB_SHA}" >> "$GITHUB_OUTPUT"
echo "Got DUCKDB_SHA='${DUCKDB_SHA}'"
popd
pushd postgres
POSTGRES_SHA=`git ls-tree HEAD --format='%(objectname)'`
echo "postgres_sha=${POSTGRES_SHA}" >> "$GITHUB_OUTPUT"
echo "Got POSTGRES_SHA='${POSTGRES_SHA}'"
- name: Setup PG build cache
id: cache-pg-build
uses: actions/cache@v4
with:
path: postgres/inst
key: pg-build-${{ matrix.version }}
key: pg-build-${{ steps.versions.outputs.postgres_sha }}

- name: Checkout and build PostgreSQL code
- name: Build PostgreSQL code
if: steps.cache-pg-build.outputs.cache-hit != 'true'
run: |
rm -rf postgres
git clone --branch ${{ matrix.version }} --single-branch --depth 1 https://github.com/postgres/postgres.git
pushd postgres
git branch
./configure --prefix=$PWD/inst/ --enable-cassert --enable-debug --with-openssl --with-icu --with-libxml
Expand Down

0 comments on commit 50d772f

Please sign in to comment.