From 61aee52a90e3c0886b9007a4762b57e29e63d6eb Mon Sep 17 00:00:00 2001 From: Eric Seppanen Date: Tue, 27 Apr 2021 09:39:13 -0700 Subject: [PATCH] split github jobs - Move notifications to a separate job, run only on push. - Build and test will execute on [pull_request, push]. - Use actions-rs/toolchain@v1 to get the rust toolchain. - Add matrix hook to allow multiple toolchain versions in the future (now set to [stable]). - Run all the cargo tests, not just test_pageserver --- .github/workflows/notifications.yml | 43 +++++++++++++++++++++++ .github/workflows/testing.yml | 53 ++++++++++------------------- 2 files changed, 61 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/notifications.yml diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml new file mode 100644 index 0000000000..402dfcf23f --- /dev/null +++ b/.github/workflows/notifications.yml @@ -0,0 +1,43 @@ +name: regression check + +on: [push] + +jobs: + send-notifications: + timeout-minutes: 30 + name: send commit notifications + 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 }} + ``` + diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a507b6881d..6234fb8cbc 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,45 +1,32 @@ -name: regression check +name: Build and Test -on: [push] +on: [push, pull_request] jobs: regression-check: + strategy: + matrix: + # If we want to duplicate this job for different + # Rust toolchains (e.g. nightly or 1.37.0), add them here. + rust_toolchain: [stable] + os: [ubuntu-latest] timeout-minutes: 30 name: run regression test suite - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} 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 + - name: install rust toolchain ${{ matrix.rust_toolchain }} + uses: actions-rs/toolchain@v1 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 }} - ``` + profile: minimal + toolchain: ${{ matrix.rust_toolchain }} + override: true - name: Install postgres dependencies run: | @@ -63,10 +50,6 @@ jobs: run: | make postgres - - name: Install rust - run: | - sudo apt install -y cargo - - name: Cache cargo deps id: cache_cargo uses: actions/cache@v2 @@ -77,10 +60,10 @@ jobs: target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Build + - name: Run cargo build run: | - cargo build + cargo build --workspace --bins --examples --tests - - name: Run test + - name: Run cargo test run: | - cargo test --test test_pageserver -- --nocapture --test-threads=1 + cargo test -- --nocapture --test-threads=1