Compare commits

...

29 Commits

Author SHA1 Message Date
Fedor Dikarev
723a79159c check for empty array '[]' not empty string [] 2024-11-20 16:41:02 +01:00
Fedor Dikarev
d133f831c0 check that changes not empty for build matrix 2024-11-20 15:38:36 +01:00
Fedor Dikarev
aa19a412e2 dont depend on itself and check that doesn;t rebuild when no changes 2024-11-20 15:33:35 +01:00
Fedor Dikarev
8d81c836a2 revert changes from pgxn/neon/Makefile 2024-11-20 15:26:59 +01:00
Fedor Dikarev
3a3fcb3745 now all together and check for build on macos-15 2024-11-20 15:16:26 +01:00
Fedor Dikarev
441e769d67 submodule update --depth 1 2024-11-20 15:12:03 +01:00
Fedor Dikarev
1bf8857962 run git submodule command 2024-11-20 15:05:05 +01:00
Fedor Dikarev
eb8a87d2ec use sparse checkout 2024-11-20 14:46:37 +01:00
Fedor Dikarev
8c9bf3e8d4 checkout only required submodule 2024-11-20 14:41:57 +01:00
Fedor Dikarev
c4ddac3fcc Merge branch 'main' into feat/ci_workflow_build_macos_2 2024-11-20 14:36:52 +01:00
Fedor Dikarev
3bb61ce8fa don't build and run on ubuntu for tests 2024-11-20 14:35:24 +01:00
Fedor Dikarev
73f494a0da will it compile on macos-14? 2024-11-19 09:46:29 +01:00
Fedor Dikarev
7ee766c8b1 runs-on: macos-15 2024-11-19 09:06:26 +01:00
Fedor Dikarev
57f58801af just checkout with submodules 2024-11-15 11:29:16 +01:00
Fedor Dikarev
22963c7531 checkout repo for build 2024-11-15 11:27:00 +01:00
Fedor Dikarev
fb05a2e549 fix workflow syntax 2024-11-15 11:18:59 +01:00
Fedor Dikarev
3ab7297a51 fix workflow syntax 2024-11-15 11:16:52 +01:00
Fedor Dikarev
b2cf8797b0 Merge branch 'main' into feat/ci_workflow_build_macos_2 2024-11-15 11:12:51 +01:00
Fedor Dikarev
e86abd8916 trigger changes to test build 2024-11-15 11:06:25 +01:00
Fedor Dikarev
9da0b4d228 actually run makes 2024-11-15 11:04:37 +01:00
Fedor Dikarev
350ae9a9fe try to sparse-checkout 2024-10-15 00:15:06 +02:00
Fedor Dikarev
44c1f52e24 remove concurrency from build-macos 2024-10-15 00:01:46 +02:00
Fedor Dikarev
f5e21b9dc2 trigger changes 2024-10-14 23:57:39 +02:00
Fedor Dikarev
e47c846821 trigger changes in pgxs 2024-10-14 23:47:06 +02:00
Fedor Dikarev
fbc6b7fae8 Merge branch 'main' into feat/ci_workflow_build_macos_2 2024-10-14 23:43:30 +02:00
Fedor Dikarev
bd517b1d60 fix build-macos.yml 2024-10-14 23:37:46 +02:00
Fedor Dikarev
10be4cbed8 fix mistype and remove unnecessary checks 2024-10-14 23:06:36 +02:00
Fedor Dikarev
f977a62727 disable build_and_test for now, run build-macos from neon_extra_build 2024-10-14 22:45:30 +02:00
Fedor Dikarev
9814b7cfaa Add workflow for MacOS build 2024-10-14 22:35:51 +02:00
3 changed files with 85 additions and 173 deletions

82
.github/workflows/build-macos.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: Check neon with MacOS builds
on:
workflow_call:
env:
RUST_BACKTRACE: 1
COPT: '-Werror'
# TODO: move `check-*` and `files-changed` jobs to the "Caller" Workflow
# We should care about that as Github has limitations:
# - You can connect up to four levels of workflows
# - You can call a maximum of 20 unique reusable workflows from a single workflow file.
# https://docs.github.com/en/actions/sharing-automations/reusing-workflows#limitations
jobs:
files-changed:
name: Detect what files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
postgres_changes: ${{ steps.postgres_changes.outputs.changes }}
steps:
- name: Checkout
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 # v4.1.7
with:
submodules: true
- name: Check for Postgres changes
uses: dorny/paths-filter@1441771bbfdd59dcd748680ee64ebd8faab1a242 #v3
id: postgres_changes
with:
token: ${{ github.token }}
filters: |
v14: ['vendor/postgres-v14/**', 'Makefile', 'pgxn/**']
v15: ['vendor/postgres-v15/**', 'Makefile', 'pgxn/**']
v16: ['vendor/postgres-v16/**', 'Makefile', 'pgxn/**']
v17: ['vendor/postgres-v17/**', 'Makefile', 'pgxn/**']
base: ${{ github.event_name != 'pull_request' && (github.event.merge_group.base_ref || github.ref_name) || '' }}
ref: ${{ github.event_name != 'pull_request' && (github.event.merge_group.head_ref || github.ref) || ''}}
check-macos-build:
needs: [ files-changed ]
if: |
needs.files-changed.outputs.postgres_changes != '[]' && (
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: 30
runs-on: ubuntu-22.04
strategy:
matrix:
postgres-version: ${{ fromJSON(needs.files-changed.outputs.postgres_changes) }}
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 main repo
uses: actions/checkout@v4
- name: Checkout submodule vendor/postgres-${{ matrix.postgres-version }}
run: |
git submodule init vendor/postgres-${{ matrix.postgres-version }}
git submodule update --depth 1
- name: Install build dependencies
run: |
echo brew install flex bison openssl protobuf icu4c
- name: Build Postgres ${{ matrix.postgres-version }}
run: |
echo make postgres-${{ matrix.postgres-version }}
- name: Build Neon Pg Ext ${{ matrix.postgres-version }}
run: |
echo make "neon-pg-ext-${{ matrix.postgres-version }}"
- name: Build walproposer-lib (only for v17)
if: matrix.postgres-version == 'v17'
run:
echo make walproposer-lib

View File

@@ -6,7 +6,7 @@ on:
- main
- release
- release-proxy
pull_request:
# pull_request:
defaults:
run:

View File

@@ -31,180 +31,10 @@ jobs:
uses: ./.github/workflows/build-build-tools-image.yml
secrets: inherit
check-macos-build:
run-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-15
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
- 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: Set pg 17 revision for caching
id: pg_v17_rev
run: echo pg_rev=$(git rev-parse HEAD:vendor/postgres-v17) >> $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: Cache postgres v17 build
id: cache_pg_17
uses: actions/cache@v4
with:
path: pg_install/v17
key: v1-${{ runner.os }}-${{ runner.arch }}-${{ env.BUILD_TYPE }}-pg-${{ steps.pg_v17_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 postgres v17
if: steps.cache_pg_17.outputs.cache-hit != 'true'
run: make postgres-v17 -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
gather-rust-build-stats:
needs: [ check-permissions, build-build-tools-image ]
if: |
contains(github.event.pull_request.labels.*.name, 'run-extra-build-stats') ||
contains(github.event.pull_request.labels.*.name, 'run-extra-build-*') ||
github.ref_name == 'main'
runs-on: [ self-hosted, large ]
container:
image: ${{ needs.build-build-tools-image.outputs.image }}-bookworm
credentials:
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
options: --init
env:
BUILD_TYPE: release
# build with incremental compilation produce partial results
# so do not attempt to cache this build, also disable the incremental compilation
CARGO_INCREMENTAL: 0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
# Some of our rust modules use FFI and need those to be checked
- name: Get postgres headers
run: make postgres-headers -j$(nproc)
- name: Build walproposer-lib
run: make walproposer-lib -j$(nproc)
- name: Produce the build stats
run: PQ_LIB_DIR=$(pwd)/pg_install/v17/lib cargo build --all --release --timings -j$(nproc)
- name: Upload the build stats
id: upload-stats
env:
BUCKET: neon-github-public-dev
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY_DEV }}
run: |
REPORT_URL=https://${BUCKET}.s3.amazonaws.com/build-stats/${SHA}/${GITHUB_RUN_ID}/cargo-timing.html
aws s3 cp --only-show-errors ./target/cargo-timings/cargo-timing.html "s3://${BUCKET}/build-stats/${SHA}/${GITHUB_RUN_ID}/"
echo "report-url=${REPORT_URL}" >> $GITHUB_OUTPUT
- name: Publish build stats report
uses: actions/github-script@v7
env:
REPORT_URL: ${{ steps.upload-stats.outputs.report-url }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
with:
# Retry script for 5XX server errors: https://github.com/actions/github-script#retries
retries: 5
script: |
const { REPORT_URL, SHA } = process.env
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: `${SHA}`,
state: 'success',
target_url: `${REPORT_URL}`,
context: `Build stats (release)`,
})
uses: ./.github/workflows/build-macos.yml