2022-09-02 05:40:13 +00:00
|
|
|
name: Pull Request
|
|
|
|
|
|
|
|
permissions:
|
2022-11-08 11:13:27 +00:00
|
|
|
# To create a draft release.
|
2022-09-02 05:40:13 +00:00
|
|
|
contents: write
|
2022-11-08 11:13:27 +00:00
|
|
|
# To comment on PRs.
|
2022-09-02 05:40:13 +00:00
|
|
|
pull-requests: write
|
2022-11-08 11:13:27 +00:00
|
|
|
# To sign artifacts.
|
|
|
|
id-token: write
|
2022-09-02 05:40:13 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2023-03-22 23:59:16 +00:00
|
|
|
paths-ignore:
|
2024-01-19 14:11:17 +00:00
|
|
|
- "sdk/.version"
|
2022-09-02 05:40:13 +00:00
|
|
|
|
|
|
|
concurrency:
|
2024-11-08 12:22:58 +00:00
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref }}
|
2022-09-02 05:40:13 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-11-15 22:26:55 +00:00
|
|
|
# The jobs in this workflow are only run on branches. The `on-community-pr.yml` job provides
|
|
|
|
# commands for running workflows from forks.
|
|
|
|
|
2022-09-02 05:40:13 +00:00
|
|
|
jobs:
|
|
|
|
info:
|
|
|
|
name: info
|
2022-11-15 22:26:55 +00:00
|
|
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
2022-09-02 05:40:13 +00:00
|
|
|
uses: ./.github/workflows/ci-info.yml
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
with:
|
2024-11-08 12:22:58 +00:00
|
|
|
ref: ${{ github.head_ref }}
|
2022-09-02 05:40:13 +00:00
|
|
|
is-snapshot: true
|
|
|
|
secrets: inherit
|
|
|
|
|
2023-08-21 18:34:09 +00:00
|
|
|
# Determines which files have changed so we can avoid running expensive tests
|
2023-03-02 22:33:45 +00:00
|
|
|
# if they're not necessary.
|
|
|
|
inspect:
|
|
|
|
name: Inspect changed files
|
2024-07-08 10:37:43 +00:00
|
|
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
2023-03-02 22:33:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-03-30 15:53:21 +00:00
|
|
|
- uses: dorny/paths-filter@v3
|
2023-03-02 22:33:45 +00:00
|
|
|
id: changes
|
|
|
|
with:
|
2024-07-15 10:38:44 +00:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2023-03-02 22:33:45 +00:00
|
|
|
filters: |
|
|
|
|
# If files matching any of these patterns change,
|
|
|
|
# we will run codegen tests for pull requests.
|
|
|
|
test-codegen:
|
|
|
|
- 'pkg/codegen/docs/**'
|
|
|
|
- 'pkg/codegen/dotnet/**'
|
|
|
|
- 'pkg/codegen/go/**'
|
|
|
|
- 'pkg/codegen/nodejs/**'
|
|
|
|
- 'pkg/codegen/python/**'
|
|
|
|
outputs:
|
|
|
|
# Add an entry here for every named pattern
|
|
|
|
# defined in filters.
|
|
|
|
test-codegen: ${{ steps.changes.outputs.test-codegen }}
|
|
|
|
|
2022-09-02 05:40:13 +00:00
|
|
|
ci:
|
|
|
|
name: CI
|
2022-11-15 22:26:55 +00:00
|
|
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
2023-03-02 22:33:45 +00:00
|
|
|
needs: [info, inspect]
|
2022-09-02 05:40:13 +00:00
|
|
|
uses: ./.github/workflows/ci.yml
|
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-11-08 11:13:27 +00:00
|
|
|
# To sign artifacts.
|
|
|
|
id-token: write
|
2022-09-02 05:40:13 +00:00
|
|
|
with:
|
2024-11-08 12:22:58 +00:00
|
|
|
ref: ${{ github.head_ref }}
|
2022-09-02 05:40:13 +00:00
|
|
|
version: ${{ needs.info.outputs.version }}
|
2022-09-14 01:52:21 +00:00
|
|
|
lint: true
|
2024-11-08 12:22:58 +00:00
|
|
|
# codegen tests are not the fastest, but we want to run them
|
|
|
|
# on PR to get correct coverage numbers.
|
|
|
|
test-codegen: true
|
2022-09-16 22:04:05 +00:00
|
|
|
test-version-sets: >- # No newlines or trailing newline.
|
2022-09-14 08:21:05 +00:00
|
|
|
${{
|
|
|
|
contains(github.event.pull_request.labels.*.name, 'ci/test')
|
2022-09-16 22:04:05 +00:00
|
|
|
&& 'minimum current'
|
|
|
|
|| 'current'
|
2022-09-14 08:21:05 +00:00
|
|
|
}}
|
2022-09-16 22:04:05 +00:00
|
|
|
integration-test-platforms: ubuntu-latest
|
2023-01-30 19:30:30 +00:00
|
|
|
acceptance-test-platforms: >- # No newlines or trailing newline.
|
2022-09-14 08:21:05 +00:00
|
|
|
${{
|
|
|
|
contains(github.event.pull_request.labels.*.name, 'ci/test')
|
2023-02-03 19:31:47 +00:00
|
|
|
&& 'macos-latest windows-latest'
|
run acceptance tests for windows on PR rather than on merge (#17114)
Acceptance tests on Windows sometimes fail for mysterious reasons. It's
unclear to me whether this is because the tests sometimes genuinely take
too many resources, and break the windows host, or whether it's
instability of the windows CI runners in general (it could also be
both).
This is very annoying during merges, because for any failed test we need
to re-do the merge, which means re-running all tests, which is both
expensive and slow.
Instead, run the acceptance tests on windows during PRs always, but
don't run them during merge.
I think this is okay to do because if there is a mismerge, I don't
expect exclusively windows tests to fail, but I expect that to also
affect Linux and MacOS runners. It seems very unlikely for a Windows
specific problem to pop up only when multiple PRs are merged together.
It is also convenient to run the windows tests during PRs in the first
place, because those are tests developers usually don't run on their own
machine, so it's not super unlikely they fail. We used to not run these
tests on PRs because it's kind of expensive to run them, but we have
more headroom now, so running them during PRs should no longer be a big
issue.
2024-09-04 10:49:07 +00:00
|
|
|
|| 'windows-latest'
|
2022-09-14 08:21:05 +00:00
|
|
|
}}
|
2024-11-08 12:22:58 +00:00
|
|
|
enable-coverage: true
|
2022-09-02 05:40:13 +00:00
|
|
|
secrets: inherit
|
|
|
|
|
2024-11-04 21:26:27 +00:00
|
|
|
performance-gate:
|
|
|
|
name: Performance Gate
|
|
|
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
|
|
|
needs: [info, inspect]
|
|
|
|
uses: ./.github/workflows/ci-performance-gate.yml
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
with:
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
version: ${{ needs.info.outputs.version }}
|
|
|
|
test-version-sets: 'minimum current'
|
|
|
|
performance-test-platforms: ubuntu-latest
|
|
|
|
secrets: inherit
|
|
|
|
|
2023-08-09 05:41:07 +00:00
|
|
|
ci-ok:
|
|
|
|
name: ci-ok
|
2024-11-04 21:26:27 +00:00
|
|
|
needs: [ci, performance-gate]
|
2024-06-27 20:34:57 +00:00
|
|
|
if: always()
|
2023-08-09 05:41:07 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-07-03 14:47:12 +00:00
|
|
|
# If the PR is a community PR, we don't run the usual checks, but instead
|
|
|
|
# require maintainers to run them manually by commenting with
|
|
|
|
# /run-acceptance-tests. Since the checks then run outside of the PR,
|
|
|
|
# ci-ok is not a useful status in these cases. We thus want to skip this
|
|
|
|
# job for community PRs. We detect community contributions by checking if
|
|
|
|
# the head repository is different to the base repository.
|
2024-06-27 20:34:57 +00:00
|
|
|
- name: CI failed
|
2024-07-03 14:47:12 +00:00
|
|
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && needs.ci.result != 'success' }}
|
2024-06-27 20:34:57 +00:00
|
|
|
run: exit 1
|
2023-08-09 05:41:07 +00:00
|
|
|
- name: CI succeeded
|
|
|
|
run: exit 0
|