Build #140
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: | |
# 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 |