Skip to content

Commit

Permalink
CI: move build on macOS to a separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Jul 5, 2024
1 parent c9fd8d7 commit 344459f
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 96 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Check neon with extra platform builds

on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/build-macos.yml'
- 'pgxn/**'
- 'vendor/**'
- 'Makefile'

defaults:
run:
shell: bash -euxo pipefail {0}

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
RUST_BACKTRACE: 1
COPT: '-Werror'

jobs:
check-permissions:
if: |

Check failure on line 28 in .github/workflows/build-macos.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/build-macos.yml#L28

if: condition "${{ (github.ref_name == 'main' && !contains(github.event.pull_request.labels.*.name, 'run-no-ci'))\n|| contains(github.event.pull_request.labels.*.name, 'run-extra-build-macos')\n|| contains(github.event.pull_request.labels.*.name, 'run-extra-build-*') }}\n" is always evaluated to true because extra characters are around ${{ }} [if-cond]
Raw output
.github/workflows/build-macos.yml:28:9: if: condition "${{ (github.ref_name == 'main' && !contains(github.event.pull_request.labels.*.name, 'run-no-ci'))\n|| contains(github.event.pull_request.labels.*.name, 'run-extra-build-macos')\n|| contains(github.event.pull_request.labels.*.name, 'run-extra-build-*') }}\n" is always evaluated to true because extra characters are around ${{ }} [if-cond]
${{ (github.ref_name == 'main' && !contains(github.event.pull_request.labels.*.name, 'run-no-ci'))
|| contains(github.event.pull_request.labels.*.name, 'run-extra-build-macos')
|| contains(github.event.pull_request.labels.*.name, 'run-extra-build-*') }}
uses: ./.github/workflows/check-permissions.yml
with:
github-event-name: ${{ github.event_name}}

neon-build-macos:
needs: [ check-permissions ]
timeout-minutes: 30
runs-on: macos-14

env:
# Use release build only, to have less debug info around
# Hence keeping target/ (and general cache size) smaller
BUILD_TYPE: release

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Install macOS postgres dependencies
run: brew install flex bison openssl protobuf icu4c pkg-config

- id: cache-pg-14
uses: actions/cache@v4
with:
path: pg_install/v14
key: v1-${{ runner.os }}-${{ runner.arch }}-${{ env.BUILD_TYPE }}-pg-${{ hashFiles('Makefile', 'vendor/postgres-v14/**/*') }}

- id: cache-pg-15
uses: actions/cache@v4
with:
path: pg_install/v15
key: v1-${{ runner.os }}-${{ runner.arch }}-${{ env.BUILD_TYPE }}-pg-${{ hashFiles('Makefile', 'vendor/postgres-v15/**/*') }}

- id: cache-pg-16
uses: actions/cache@v4
with:
path: pg_install/v16
key: v1-${{ runner.os }}-${{ runner.arch }}-${{ env.BUILD_TYPE }}-pg-${{ hashFiles('Makefile', 'vendor/postgres-v16/**/*') }}

- name: Set extra env for macOS
run: |
echo 'LDFLAGS=-L/usr/local/opt/openssl@3/lib' >> $GITHUB_ENV
echo 'CPPFLAGS=-I/usr/local/opt/openssl@3/include' >> $GITHUB_ENV
- name: Cache cargo deps
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
!~/.cargo/registry/src
~/.cargo/git
target
key: v1-${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('./Cargo.lock') }}-${{ hashFiles('./rust-toolchain.toml') }}-rust

- name: Build postgres v14
if: steps.cache-pg-14.outputs.cache-hit != 'true'
run: make postgres-v14 -j$(sysctl -n hw.ncpu)

- name: Build postgres v15
if: steps.cache-pg-15.outputs.cache-hit != 'true'
run: make postgres-v15 -j$(sysctl -n hw.ncpu)

- name: Build postgres v16
if: steps.cache-pg-16.outputs.cache-hit != 'true'
run: make postgres-v16 -j$(sysctl -n hw.ncpu)

- name: Build neon extensions
run: make neon-pg-ext -j$(sysctl -n hw.ncpu)

- name: Build walproposer-lib
run: make walproposer-lib -j$(sysctl -n hw.ncpu)

- name: Run cargo build
run: PQ_LIB_DIR=$(pwd)/pg_install/v16/lib cargo build --all --release

- name: Check that no warnings are produced
run: ./run_clippy.sh
96 changes: 0 additions & 96 deletions .github/workflows/neon_extra_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,102 +37,6 @@ jobs:
image-tag: ${{ needs.check-build-tools-image.outputs.image-tag }}
secrets: inherit

check-macos-build:
needs: [ check-permissions ]
if: |
contains(github.event.pull_request.labels.*.name, 'run-extra-build-macos') ||
contains(github.event.pull_request.labels.*.name, 'run-extra-build-*') ||
github.ref_name == 'main'
timeout-minutes: 90
runs-on: macos-14

env:
# Use release build only, to have less debug info around
# Hence keeping target/ (and general cache size) smaller
BUILD_TYPE: release

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1

- name: Install macOS postgres dependencies
run: brew install flex bison openssl protobuf icu4c pkg-config

- name: Set pg 14 revision for caching
id: pg_v14_rev
run: echo pg_rev=$(git rev-parse HEAD:vendor/postgres-v14) >> $GITHUB_OUTPUT

- name: Set pg 15 revision for caching
id: pg_v15_rev
run: echo pg_rev=$(git rev-parse HEAD:vendor/postgres-v15) >> $GITHUB_OUTPUT

- name: Set pg 16 revision for caching
id: pg_v16_rev
run: echo pg_rev=$(git rev-parse HEAD:vendor/postgres-v16) >> $GITHUB_OUTPUT

- name: Cache postgres v14 build
id: cache_pg_14
uses: actions/cache@v4
with:
path: pg_install/v14
key: v1-${{ runner.os }}-${{ runner.arch }}-${{ env.BUILD_TYPE }}-pg-${{ steps.pg_v14_rev.outputs.pg_rev }}-${{ hashFiles('Makefile') }}

- name: Cache postgres v15 build
id: cache_pg_15
uses: actions/cache@v4
with:
path: pg_install/v15
key: v1-${{ runner.os }}-${{ runner.arch }}-${{ env.BUILD_TYPE }}-pg-${{ steps.pg_v15_rev.outputs.pg_rev }}-${{ hashFiles('Makefile') }}

- name: Cache postgres v16 build
id: cache_pg_16
uses: actions/cache@v4
with:
path: pg_install/v16
key: v1-${{ runner.os }}-${{ runner.arch }}-${{ env.BUILD_TYPE }}-pg-${{ steps.pg_v16_rev.outputs.pg_rev }}-${{ hashFiles('Makefile') }}

- name: Set extra env for macOS
run: |
echo 'LDFLAGS=-L/usr/local/opt/openssl@3/lib' >> $GITHUB_ENV
echo 'CPPFLAGS=-I/usr/local/opt/openssl@3/include' >> $GITHUB_ENV
- name: Cache cargo deps
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
!~/.cargo/registry/src
~/.cargo/git
target
key: v1-${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('./Cargo.lock') }}-${{ hashFiles('./rust-toolchain.toml') }}-rust

- name: Build postgres v14
if: steps.cache_pg_14.outputs.cache-hit != 'true'
run: make postgres-v14 -j$(sysctl -n hw.ncpu)

- name: Build postgres v15
if: steps.cache_pg_15.outputs.cache-hit != 'true'
run: make postgres-v15 -j$(sysctl -n hw.ncpu)

- name: Build postgres v16
if: steps.cache_pg_16.outputs.cache-hit != 'true'
run: make postgres-v16 -j$(sysctl -n hw.ncpu)

- name: Build neon extensions
run: make neon-pg-ext -j$(sysctl -n hw.ncpu)

- name: Build walproposer-lib
run: make walproposer-lib -j$(sysctl -n hw.ncpu)

- name: Run cargo build
run: PQ_LIB_DIR=$(pwd)/pg_install/v16/lib cargo build --all --release

- name: Check that no warnings are produced
run: ./run_clippy.sh

check-linux-arm-build:
needs: [ check-permissions, build-build-tools-image ]
timeout-minutes: 90
Expand Down

0 comments on commit 344459f

Please sign in to comment.