| 1 |
name: Staleness tests |
| 2 |
|
| 3 |
on: |
| 4 |
schedule: |
| 5 |
|
| 6 |
- cron: 0 10 * * * |
| 7 |
workflow_call: |
| 8 |
inputs: |
| 9 |
safe-checkout: |
| 10 |
required: false |
| 11 |
description: "The SHA key for the commit we want to run over" |
| 12 |
type: string |
| 13 |
workflow_dispatch: |
| 14 |
|
| 15 |
permissions: {} |
| 16 |
jobs: |
| 17 |
test: |
| 18 |
strategy: |
| 19 |
fail-fast: false |
| 20 |
matrix: |
| 21 |
branch: [main, 22.x, 23.x, 24.x] |
| 22 |
os: [{ name: Linux, value: ubuntu-latest}] |
| 23 |
|
| 24 |
name: Test staleness ${{ matrix.os.name }} ${{ matrix.branch}} |
| 25 |
runs-on: ${{ matrix.os.value }} |
| 26 |
if: ${{ github.event.repository.full_name == 'protocolbuffers/protobuf' }} |
| 27 |
steps: |
| 28 |
- name: Checkout ${{ matrix.branch }} |
| 29 |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c |
| 30 |
with: |
| 31 |
ref: ${{ inputs.safe-checkout || matrix.branch}} |
| 32 |
|
| 33 |
- name: Mark runs associated with commits |
| 34 |
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} |
| 35 |
run: echo "COMMIT_TRIGGERED_RUN=1" >> $GITHUB_ENV |
| 36 |
|
| 37 |
- name: Mark runs from the main branch |
| 38 |
if: ${{ github.base_ref == 'main' || github.ref == 'refs/heads/main' }} |
| 39 |
run: echo "MAIN_RUN=1" >> $GITHUB_ENV |
| 40 |
|
| 41 |
- name: Run all staleness tests |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
run: | |
| 53 |
if [[ -z $COMMIT_TRIGGERED_RUN || -z $MAIN_RUN ]]; then |
| 54 |
bazel query 'attr(tags, "staleness_test", //...)' | xargs bazel test $BAZEL_FLAGS |
| 55 |
else |
| 56 |
bazel query 'attr(tags, "staleness_test", //...)' |
| 57 |
fi |