Skip to content

Commit

Permalink
build-and-test-locally: check diesel schema
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Jan 31, 2025
1 parent 361222e commit fce6b0e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 35 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/_build-and-test-locally.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,26 @@ jobs:
path: /tmp/neon
aws-oicd-role-arn: ${{ vars.DEV_AWS_OIDC_ROLE_ARN }}

- name: Check diesel schema
if: inputs.build-type == 'release' && inputs.arch == 'x64'
env:
DATABASE_URL: postgresql://localhost:1235/storage_controller
POSTGRES_DISTRIB_DIR: /tmp/neon/pg_install
run: |
/tmp/neon/bin/neon_local init
/tmp/neon/bin/neon_local storage_controller start
diesel print-schema > storage_controller/src/schema.rs
if [ -n "$(git diff storage_controller/src/schema.rs)" ]; then
echo >&2 "Uncommitted changes in diesel schema"
git diff .
exit 1
fi
/tmp/neon/bin/neon_local storage_controller stop
# XXX: keep this after the binaries.list is formed, so the coverage can properly work later
- name: Merge and upload coverage data
if: inputs.build-type == 'debug'
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/_check-codestyle-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,38 +92,3 @@ jobs:
- name: Check rust licenses/bans/advisories/sources
if: ${{ !cancelled() }}
run: cargo deny check --hide-inclusion-graph

# # To check diesel schema, we need any version of Postgres, so get it from build artifacts
# - name: Download Latest Neon artifact
# if: ${{ !cancelled() }}
# uses: ./.github/actions/download
# with:
# name: neon-${{ runner.os }}-${{ runner.arch }}-release-artifact
# path: /tmp/neon/
# prefix: latest
# aws-oicd-role-arn: ${{ vars.DEV_AWS_OIDC_ROLE_ARN }}

- name: Compile required thing
run: |
make postgres-v16 -j$(nproc)
make neon -j$(nproc)
- name: Check diesel schema
if: ${{ !cancelled() }}
env:
# POSTGRES_DISTRIB_DIR: /tmp/neon/pg_install
DATABASE_URL: postgresql://localhost:1235/storage_controller
run: |
# export LD_LIBRARY_PATH=${POSTGRES_DISTRIB_DIR}/v16/lib
cargo neon init
cargo neon storage_controller start
diesel print-schema > storage_controller/src/schema.rs
if [ -n "$(git diff storage_controller/src/schema.rs)" ]; then
echo >&2 "Uncommitted changes in diesel schema"
git diff .
exit 1
fi

0 comments on commit fce6b0e

Please sign in to comment.