mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 13:32:57 +00:00
Reverts neondatabase/neon#11663 and https://github.com/neondatabase/neon/pull/11265/ Step Security is not yet approved by Databricks team, in order to prevent issues during Github org migration, I'll revert this PR to use the previous action instead of Step Security maintained action.
163 lines
5.9 KiB
YAML
163 lines
5.9 KiB
YAML
name: Check neon with extra platform builds
|
|
|
|
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_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
COPT: '-Werror'
|
|
|
|
jobs:
|
|
check-permissions:
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'run-no-ci') }}
|
|
uses: ./.github/workflows/check-permissions.yml
|
|
with:
|
|
github-event-name: ${{ github.event_name}}
|
|
|
|
build-build-tools-image:
|
|
needs: [ check-permissions ]
|
|
uses: ./.github/workflows/build-build-tools-image.yml
|
|
secrets: inherit
|
|
|
|
files-changed:
|
|
name: Detect what files changed
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 3
|
|
outputs:
|
|
v17: ${{ steps.files_changed.outputs.v17 }}
|
|
postgres_changes: ${{ steps.postgres_changes.outputs.changes }}
|
|
rebuild_rust_code: ${{ steps.files_changed.outputs.rust_code }}
|
|
rebuild_everything: ${{ steps.files_changed.outputs.rebuild_neon_extra || steps.files_changed.outputs.rebuild_macos }}
|
|
|
|
steps:
|
|
- name: Harden the runner (Audit all outbound calls)
|
|
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Check for Postgres changes
|
|
uses: dorny/paths-filter@1441771bbfdd59dcd748680ee64ebd8faab1a242 #v3
|
|
id: files_changed
|
|
with:
|
|
token: ${{ github.token }}
|
|
filters: .github/file-filters.yaml
|
|
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) || '' }}
|
|
|
|
- name: Filter out only v-string for build matrix
|
|
id: postgres_changes
|
|
env:
|
|
CHANGES: ${{ steps.files_changed.outputs.changes }}
|
|
run: |
|
|
v_strings_only_as_json_array=$(echo ${CHANGES} | jq '.[]|select(test("v\\d+"))' | jq --slurp -c)
|
|
echo "changes=${v_strings_only_as_json_array}" | tee -a "${GITHUB_OUTPUT}"
|
|
|
|
check-macos-build:
|
|
needs: [ check-permissions, files-changed ]
|
|
uses: ./.github/workflows/build-macos.yml
|
|
with:
|
|
pg_versions: ${{ needs.files-changed.outputs.postgres_changes }}
|
|
rebuild_rust_code: ${{ fromJSON(needs.files-changed.outputs.rebuild_rust_code) }}
|
|
rebuild_everything: ${{ fromJSON(needs.files-changed.outputs.rebuild_everything) }}
|
|
|
|
gather-rust-build-stats:
|
|
needs: [ check-permissions, build-build-tools-image, files-changed ]
|
|
permissions:
|
|
id-token: write # aws-actions/configure-aws-credentials
|
|
statuses: write
|
|
contents: write
|
|
if: |
|
|
(needs.files-changed.outputs.v17 == 'true' || needs.files-changed.outputs.rebuild_everything == 'true') && (
|
|
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: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
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: Harden the runner (Audit all outbound calls)
|
|
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
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: cargo build --all --release --timings -j$(nproc)
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
|
with:
|
|
aws-region: eu-central-1
|
|
role-to-assume: ${{ vars.DEV_AWS_OIDC_ROLE_ARN }}
|
|
role-duration-seconds: 3600
|
|
|
|
- name: Upload the build stats
|
|
id: upload-stats
|
|
env:
|
|
BUCKET: neon-github-public-dev
|
|
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
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)`,
|
|
})
|