mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-10 23:12:54 +00:00
* Add submodule postgres-15 * Support pg_15 in pgxn/neon * Renamed zenith -> neon in Makefile * fix name of codestyle check * Refactor build system to prepare for building multiple Postgres versions. Rename "vendor/postgres" to "vendor/postgres-v14" Change Postgres build and install directory paths to be version-specific: - tmp_install/build -> pg_install/build/14 - tmp_install/* -> pg_install/14/* And Makefile targets: - "make postgres" -> "make postgres-v14" - "make postgres-headers" -> "make postgres-v14-headers" - etc. Add Makefile aliases: - "make postgres" to build "postgres-v14" and in future, "postgres-v15" - similarly for "make postgres-headers" Fix POSTGRES_DISTRIB_DIR path in pytest scripts * Make postgres version a variable in codestyle workflow * Support vendor/postgres-v15 in codestyle check workflow * Support postgres-v15 building in Makefile * fix pg version in Dockerfile.compute-node * fix kaniko path * Build neon extensions in version-specific directories * fix obsolete mentions of vendor/postgres * use vendor/postgres-v14 in Dockerfile.compute-node.legacy * Use PG_VERSION_NUM to gate dependencies in inmem_smgr.c * Use versioned ECR repositories and image names for compute-node. The image name format is compute-node-vXX, where XX is postgres major version number. For now only v14 is supported. Old format unversioned name (compute-node) is left, because cloud repo depends on it. * update vendor/postgres submodule url (zenith->neondatabase rename) * Fix postgres path in python tests after rebase * fix path in regress test * Use separate dockerfiles to build compute-node: Dockerfile.compute-node-v15 should be identical to Dockerfile.compute-node-v14 except for the version number. This is a hack, because Kaniko doesn't support build ARGs properly * bump vendor/postgres-v14 and vendor/postgres-v15 * Don't use Kaniko cache for v14 and v15 compute-node images * Build compute-node images for different versions in different jobs Co-authored-by: Heikki Linnakangas <heikki@neon.tech>
147 lines
4.4 KiB
YAML
147 lines
4.4 KiB
YAML
name: Check code style and build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|
|
|
|
concurrency:
|
|
# Allow only one workflow per any non-`main` branch.
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.sha || 'anysha' }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
|
|
jobs:
|
|
check-codestyle-rust:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# If we want to duplicate this job for different
|
|
# Rust toolchains (e.g. nightly or 1.37.0), add them here.
|
|
rust_toolchain: [1.58]
|
|
os: [ubuntu-latest, macos-latest]
|
|
# To support several Postgres versions, add them here.
|
|
postgres_version: [v14, v15]
|
|
timeout-minutes: 60
|
|
name: check codestyle rust and postgres
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 2
|
|
|
|
- name: Install rust toolchain ${{ matrix.rust_toolchain }}
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: ${{ matrix.rust_toolchain }}
|
|
components: rustfmt, clippy
|
|
override: true
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Install Ubuntu postgres dependencies
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install build-essential libreadline-dev zlib1g-dev flex bison libseccomp-dev libssl-dev
|
|
|
|
- name: Install macOS postgres dependencies
|
|
if: matrix.os == 'macos-latest'
|
|
run: brew install flex bison openssl
|
|
|
|
- name: Set pg revision for caching
|
|
id: pg_ver
|
|
run: echo ::set-output name=pg_rev::$(git rev-parse HEAD:vendor/postgres-${{matrix.postgres_version}})
|
|
|
|
- name: Cache postgres ${{matrix.postgres_version}} build
|
|
id: cache_pg
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
pg_install/${{matrix.postgres_version}}
|
|
key: ${{ runner.os }}-pg-${{ steps.pg_ver.outputs.pg_rev }}
|
|
|
|
- name: Set extra env for macOS
|
|
if: matrix.os == 'macos-latest'
|
|
run: |
|
|
echo 'LDFLAGS=-L/usr/local/opt/openssl@3/lib' >> $GITHUB_ENV
|
|
echo 'CPPFLAGS=-I/usr/local/opt/openssl@3/include' >> $GITHUB_ENV
|
|
|
|
- name: Build postgres
|
|
if: steps.cache_pg.outputs.cache-hit != 'true'
|
|
run: make postgres
|
|
|
|
- name: Build neon extensions
|
|
run: make neon-pg-ext
|
|
|
|
# Plain configure output can contain weird errors like 'error: C compiler cannot create executables'
|
|
# and the real cause will be inside config.log
|
|
- name: Print configure logs in case of failure
|
|
if: failure()
|
|
continue-on-error: true
|
|
run: |
|
|
echo '' && echo '=== Postgres ${{matrix.postgres_version}} config.log ===' && echo ''
|
|
cat pg_install/build/${{matrix.postgres_version}}/config.log
|
|
echo '' && echo '=== Postgres ${{matrix.postgres_version}} configure.log ===' && echo ''
|
|
cat pg_install/build/${{matrix.postgres_version}}/configure.log
|
|
|
|
- name: Cache cargo deps
|
|
id: cache_cargo
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
!~/.cargo/registry/src
|
|
~/.cargo/git
|
|
target
|
|
key: v3-${{ runner.os }}-cargo-${{ hashFiles('./Cargo.lock') }}-rust-${{ matrix.rust_toolchain }}
|
|
|
|
- name: Run cargo clippy
|
|
run: ./run_clippy.sh
|
|
|
|
- name: Ensure all project builds
|
|
run: cargo build --locked --all --all-targets
|
|
|
|
check-codestyle-python:
|
|
runs-on: [ self-hosted, Linux, k8s-runner ]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: false
|
|
fetch-depth: 1
|
|
|
|
- name: Cache poetry deps
|
|
id: cache_poetry
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pypoetry/virtualenvs
|
|
key: v1-codestyle-python-deps-${{ hashFiles('poetry.lock') }}
|
|
|
|
- name: Install Python deps
|
|
run: ./scripts/pysync
|
|
|
|
- name: Run isort to ensure code format
|
|
run: poetry run isort --diff --check .
|
|
|
|
- name: Run black to ensure code format
|
|
run: poetry run black --diff --check .
|
|
|
|
- name: Run flake8 to ensure code format
|
|
run: poetry run flake8 .
|
|
|
|
- name: Run mypy to check types
|
|
run: poetry run mypy .
|