Skip to content

Commit

Permalink
Cleanup scheduled staleness tests.
Browse files Browse the repository at this point in the history
- Do some minimal sanity testing on every PR
- Only run the staleness tests on a daily schedule or explicit runs.
- Add 23.x to the checks

PiperOrigin-RevId: 537952151
  • Loading branch information
mkruskal-google committed Jun 9, 2023
1 parent 9980541 commit 901cfbe
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/staleness_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
schedule:
# Run daily at 10 AM UTC (2 AM PDT)
- cron: 0 10 * * *
workflow_call:
inputs:
safe-checkout:
required: false
description: "The SHA key for the commit we want to run over"
type: string
workflow_dispatch:

permissions: {}
Expand All @@ -12,20 +18,32 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: [main, 22.x]
branch: [main, 22.x, 23.x]
os: [{ name: Linux, value: ubuntu-latest}]

name: Test staleness ${{ matrix.os.name }} ${{ matrix.branch}}
runs-on: ${{ matrix.os.value }}
if: ${{ github.event.repository.full_name == 'protocolbuffers/protobuf' || matrix.branch == 'main '}}
if: ${{ github.event.repository.full_name == 'protocolbuffers/protobuf' }}
steps:
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ matrix.branch}}
ref: ${{ inputs.safe-checkout || matrix.branch}}

# For commit-based tests, simply run the bazel query to make sure it works. This should be
# identical to the step below, except for the xargs piece that runs bazel test.
- name: Check that staleness tests are queryable
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_call'}}
uses: protocolbuffers/protobuf-ci/bazel-docker@v1
with:
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.0.0-6361b3a6e5c97e9951d03a4de28542fc45f1adab
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: staleness_check/${{ matrix.branch}}_${{ matrix.os.value }}
bash: bazel query 'attr(tags, "staleness_test", //...)'

- name: Run all staleness tests
uses: protocolbuffers/protobuf-ci/bazel@v1
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_call' }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v1
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: staleness_check/${{ matrix.branch}}_${{ matrix.os.value }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,11 @@ jobs:
with:
safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }}
secrets: inherit

staleness:
name: Staleness
needs: [check-tag]
uses: ./.github/workflows/staleness_check.yml
with:
safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }}
secrets: inherit

0 comments on commit 901cfbe

Please sign in to comment.