From 71753dd947373f5536d2a2d4dbad3d8cf866fb6e Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 19 Jul 2022 16:37:37 +0300 Subject: [PATCH] Remove github CI 'build_postgres' job, merging it with 'build_neon' Simplifies the workflow. Makes the overall build a little faster, as the build_postgres step doesn't need to upload the pg.tgz artifact, and the build_neon step doesn't need to download it again. This effectively reverts commit a490f64a68. That commit changed the workflow so that the Postgres binaries were not included in the neon.tgz artifact. With this commit, the pg.tgz artifact is gone, and the Postgres binaries are part of neon.tgz again. --- .../actions/run-python-test-set/action.yml | 15 +--- .github/workflows/build_and_test.yml | 70 +++++-------------- 2 files changed, 17 insertions(+), 68 deletions(-) diff --git a/.github/actions/run-python-test-set/action.yml b/.github/actions/run-python-test-set/action.yml index f220be2b12..accb8896de 100644 --- a/.github/actions/run-python-test-set/action.yml +++ b/.github/actions/run-python-test-set/action.yml @@ -37,12 +37,6 @@ runs: name: neon-${{ runner.os }}-${{ inputs.build_type }}-${{ inputs.rust_toolchain }}-artifact path: ./neon-artifact/ - - name: Get Postgres artifact for restoration - uses: actions/download-artifact@v3 - with: - name: postgres-${{ runner.os }}-${{ inputs.build_type }}-artifact - path: ./pg-artifact/ - - name: Extract Neon artifact shell: bash -ex {0} run: | @@ -50,13 +44,6 @@ runs: tar -xf ./neon-artifact/neon.tgz -C /tmp/neon/ rm -rf ./neon-artifact/ - - name: Extract Postgres artifact - shell: bash -ex {0} - run: | - mkdir -p /tmp/neon/tmp_install - tar -xf ./pg-artifact/pg.tgz -C /tmp/neon/tmp_install - rm -rf ./pg-artifact/ - - name: Checkout if: inputs.needs_postgres_source == 'true' uses: actions/checkout@v3 @@ -78,7 +65,7 @@ runs: - name: Run pytest env: NEON_BIN: /tmp/neon/bin - POSTGRES_DISTRIB_DIR: /tmp/neon/tmp_install + POSTGRES_DISTRIB_DIR: /tmp/neon/pg_install TEST_OUTPUT: /tmp/test_output # this variable will be embedded in perf test report # and is needed to distinguish different environments diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 95da34dc62..e20dc08697 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -21,7 +21,7 @@ env: COPT: '-Werror' jobs: - build-postgres: + build-neon: runs-on: [ self-hosted, Linux, k8s-runner ] strategy: fail-fast: false @@ -31,6 +31,7 @@ jobs: env: BUILD_TYPE: ${{ matrix.build_type }} + steps: - name: Checkout uses: actions/checkout@v3 @@ -42,48 +43,6 @@ jobs: id: pg_ver run: echo ::set-output name=pg_rev::$(git rev-parse HEAD:vendor/postgres) - - name: Cache postgres build - id: cache_pg - uses: actions/cache@v3 - with: - path: tmp_install/ - key: v1-${{ runner.os }}-${{ matrix.build_type }}-pg-${{ steps.pg_ver.outputs.pg_rev }}-${{ hashFiles('Makefile') }} - - - name: Build postgres - if: steps.cache_pg.outputs.cache-hit != 'true' - run: mold -run make postgres -j$(nproc) - - # actions/cache@v3 does not allow concurrently using the same cache across job steps, so use a separate cache - - name: Prepare postgres artifact - run: tar -C tmp_install/ -czf ./pg.tgz . - - name: Upload postgres artifact - uses: actions/upload-artifact@v3 - with: - retention-days: 7 - if-no-files-found: error - name: postgres-${{ runner.os }}-${{ matrix.build_type }}-artifact - path: ./pg.tgz - - - build-neon: - runs-on: [ self-hosted, Linux, k8s-runner ] - needs: [ build-postgres ] - strategy: - fail-fast: false - matrix: - build_type: [ debug, release ] - rust_toolchain: [ 1.58 ] - - env: - BUILD_TYPE: ${{ matrix.build_type }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 1 - # Set some environment variables used by all the steps. # # CARGO_FLAGS is extra options to pass to "cargo build", "cargo test" etc. @@ -107,17 +66,6 @@ jobs: echo "CARGO_FEATURES=${CARGO_FEATURES}" >> $GITHUB_ENV echo "CARGO_FLAGS=${CARGO_FLAGS}" >> $GITHUB_ENV - - name: Get postgres artifact for restoration - uses: actions/download-artifact@v3 - with: - name: postgres-${{ runner.os }}-${{ matrix.build_type }}-artifact - path: ./postgres-artifact/ - - name: Extract postgres artifact - run: | - mkdir ./tmp_install/ - tar -xf ./postgres-artifact/pg.tgz -C ./tmp_install/ - rm -rf ./postgres-artifact/ - # Don't include the ~/.cargo/registry/src directory. It contains just # uncompressed versions of the crates in ~/.cargo/registry/cache # directory, and it's faster to let 'cargo' to rebuild it from the @@ -136,6 +84,17 @@ jobs: v2-${{ runner.os }}-${{ matrix.build_type }}-cargo-${{ matrix.rust_toolchain }}-${{ hashFiles('Cargo.lock') }} v2-${{ runner.os }}-${{ matrix.build_type }}-cargo-${{ matrix.rust_toolchain }}- + - name: Cache postgres build + id: cache_pg + uses: actions/cache@v3 + with: + path: tmp_install/ + key: v1-${{ runner.os }}-${{ matrix.build_type }}-pg-${{ steps.pg_ver.outputs.pg_rev }}-${{ hashFiles('Makefile') }} + + - name: Build postgres + if: steps.cache_pg.outputs.cache-hit != 'true' + run: mold -run make postgres -j$(nproc) + - name: Run cargo build run: | ${cov_prefix} mold -run cargo build $CARGO_FLAGS --features failpoints --bins --tests @@ -183,6 +142,9 @@ jobs: done fi + - name: Install postgres binaries + run: cp -a tmp_install /tmp/neon/pg_install + - name: Prepare neon artifact run: tar -C /tmp/neon/ -czf ./neon.tgz .