peerdb_exec #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pg-version: [14] | |
steps: | |
- name: Add PG_VERSION to env | |
run: | | |
echo "PG_VERSION=${{ matrix.pg-version }}" >> $GITHUB_ENV | |
echo "PG_SRC_DIR=$HOME/pg${{ matrix.pg-version }}" >> $GITHUB_ENV | |
- name: Get latest commit id of PostgreSQL ${{ env.PG_VERSION }} | |
run: | | |
echo "PG_COMMIT_HASH=$(git ls-remote git://git.postgresql.org/git/postgresql.git refs/heads/REL_${PG_VERSION}_STABLE | awk '{print $1}')" >> $GITHUB_ENV | |
- name: Cache PostgreSQL ${{ env.PG_VERSION }} | |
uses: actions/cache@v4 | |
id: pg-source-cache | |
with: | |
path: ${{ env.PG_SRC_DIR }} | |
key: ${{ runner.os }}-v2-pg-${{ env.PG_COMMIT_HASH }} | |
- name: Install PostgreSQL ${{ env.PG_VERSION }} | |
if: steps.pg-source-cache.outputs.cache-hit != 'true' | |
run: | | |
git clone --depth 1 --branch REL_${PG_VERSION}_STABLE git://git.postgresql.org/git/postgresql.git $PG_SRC_DIR | |
cd $PG_SRC_DIR | |
./configure --prefix=$PG_SRC_DIR CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert | |
make install -j$(nproc) > /dev/null | |
- uses: actions/checkout@v4 | |
- name: Build | |
id: build | |
run: | | |
make PG_CONFIG=$PG_SRC_DIR/bin/pg_config install -j$(nproc) | |
- name: Package Extension | |
id: package | |
run: | | |
npm install | |
npm run main -- --pgVersion $PG_VERSION | |
working-directory: ${{ github.workspace }}/packaging | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
${{ github.workspace }}/*.deb |