Debian Codegraph @

extra/protobuf/protobuf-24.4/.github/workflows/staleness_check.yml

raw symbols SCIP
1 name: Staleness tests
2
3 on:
4 schedule:
5 # Run daily at 10 AM UTC (2 AM PDT)
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 # v3.3.0
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 # Run all tests if either of the following is true, otherwise simply run the query to make
43 # sure it continues to work:
44 # 1) If this is not a commit-based run it means it's scheduled or manually dispatched. In
45 # this case we want to make sure there are no stale files.
46 # 2) Release branches don't work with automated commits (see b/287117570). Until this is
47 # fixed, we want to run the tests to force manual regeneration when necessary.
48 #
49 # In branches where automatic updates work as post-submits, we don't want to run staleness
50 # tests along with user changes. Any stale files will be automatically fixed in a follow-up
51 # commit.
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