From dab1f0381cdddebc52be227a67175c201ea48c08 Mon Sep 17 00:00:00 2001 From: Stas Kelvich Date: Mon, 5 Apr 2021 15:23:18 +0300 Subject: [PATCH] Cache postgres build and cargo deps in CI builds Now most of CI check time is spent during dependencies installation and compilation (~ 10min total). Use actions/cache@v2 to cache things between checks. This commit sets up two caching targets: * ./tmp_install with postgres build files and installed binaries uses $runner.os-pg-$pg_submodule_revision as a cache key and will be rebuilt only if linked submodule revision changes. * ./target with cargo dependencies. That one uses hash(Cargo.lock) as a caching key and will be rebuilt only on deps update. Also add tg notifications in a passing. --- .github/workflows/testing.yml | 60 ++++++++++++++++++++++++++++++++++- src/page_service.rs | 3 +- vendor/postgres | 2 +- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 756566caa3..1efc44dedf 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,6 +1,6 @@ name: regression check -on: [push, pull_request] +on: [push] jobs: regression-check: @@ -8,16 +8,57 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout uses: actions/checkout@v2 with: submodules: true + fetch-depth: 2 + + - name: Form variables for notification message + id: git_info_grab + run: | + git_stat=$(git show --stat=50) + git_stat="${git_stat//'%'/'%25'}" + git_stat="${git_stat//$'\n'/'%0A'}" + git_stat="${git_stat//$'\r'/'%0D'}" + git_stat="${git_stat// / }" # space -> 'Space En', as github tends to eat ordinary spaces + echo "::set-output name=git_stat::$git_stat" + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "##[set-output name=git_branch;]$(echo ${GITHUB_REF#refs/heads/})" + + - name: Send notification + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + format: markdown + args: | + *@${{ github.actor }} pushed to* [${{ github.repository }}:${{steps.git_info_grab.outputs.git_branch}}](github.com/${{ github.repository }}/commit/${{steps.git_info_grab.outputs.sha_short }}) + + ``` + ${{ steps.git_info_grab.outputs.git_stat }} + ``` - name: Install postgres dependencies run: | + sudo apt update sudo apt install build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libcurl4-openssl-dev + - name: Set pg revision for caching + 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@v2 + with: + path: | + tmp_install/ + key: ${{ runner.os }}-pg-${{ steps.pg_ver.outputs.pg_rev }} + - name: Build postgres + if: steps.cache_pg.outputs.cache-hit != 'true' run: | ./pgbuild.sh @@ -25,6 +66,23 @@ jobs: run: | sudo apt install -y cargo + - name: Cache cargo deps + id: cache_cargo + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + # That build is only to build dependencies and can be skipped if Cargo.lock + # wasn't changed. Next steps need their own build + - name: Install cargo deps + if: steps.cache_cargo.outputs.cache-hit != 'true' + run: | + cargo build + - name: Run test run: | cargo test --test test_pageserver -- --nocapture --test-threads=1 diff --git a/src/page_service.rs b/src/page_service.rs index a527ce7538..91fe69a553 100644 --- a/src/page_service.rs +++ b/src/page_service.rs @@ -7,6 +7,7 @@ // *status* -- show actual info about this pageserver, // *pagestream* -- enter mode where smgr and pageserver talk with their // custom protocol. +// *callmemaybe $url* -- ask pageserver to start walreceiver on $url // use tokio::net::{TcpListener, TcpStream}; @@ -499,8 +500,6 @@ impl Connection { loop { let message = self.read_message().await?; - // XXX: none seems to appear a lot in log. - // Do we have conditions for busy-loop here? if let Some(m) = &message { info!("query({}): {:?}", sysid, m); }; diff --git a/vendor/postgres b/vendor/postgres index 181d336233..4d9461aebd 160000 --- a/vendor/postgres +++ b/vendor/postgres @@ -1 +1 @@ -Subproject commit 181d336233c7d931837e5cdc15b38bdb5c3b7ec7 +Subproject commit 4d9461aebdd41a4bd1ec99a2a2d4f6d2415c0437