Skip to content

ci: use flakybot with matrix workflows #3112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
99d8584
ci: use flakybot with matrix workflows
kweinmeister Apr 7, 2023
ecbbc69
fix typo
kweinmeister Apr 7, 2023
e81707c
update common test file
kweinmeister Apr 7, 2023
aebccf2
test
kweinmeister Apr 7, 2023
7acc63c
add missing npm tests
kweinmeister Apr 7, 2023
544e82f
add matrix support
kweinmeister Apr 7, 2023
42d9087
Merge branch 'main' into flakybot-matrix
kweinmeister Apr 7, 2023
a64951b
update example text
kweinmeister Apr 9, 2023
807b815
Merge branch 'main' of https://github.com/GoogleCloudPlatform/nodejs-…
kweinmeister Apr 9, 2023
7f444cc
Merge branch 'flakybot-matrix' of https://github.com/GoogleCloudPlatf…
kweinmeister Apr 9, 2023
87814c5
Merge branch 'main' into flakybot-matrix
kweinmeister Apr 10, 2023
ce13f02
address code review feedback
kweinmeister Apr 14, 2023
937439b
Merge branch 'flakybot-matrix' of https://github.com/GoogleCloudPlatf…
kweinmeister Apr 14, 2023
6947e5f
test workflow
kweinmeister Apr 15, 2023
d2d5311
test schedule
kweinmeister Apr 15, 2023
353874b
fix upload logic for testing
kweinmeister Apr 15, 2023
785d25b
test template
kweinmeister Apr 15, 2023
8fbebeb
revert test to functions-slack
kweinmeister Apr 15, 2023
3122f87
fix license header
kweinmeister Apr 15, 2023
c891e28
add newline
kweinmeister Apr 15, 2023
8819097
Merge branch 'main' into flakybot-matrix
kweinmeister Apr 15, 2023
613269c
fix formatting
kweinmeister Apr 15, 2023
950da98
Merge branch 'flakybot-matrix' of https://github.com/GoogleCloudPlatf…
kweinmeister Apr 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

on:
push:
branches:
Expand Down Expand Up @@ -26,4 +40,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ./.github/workflows/region-tags-tests.sh
- run: ./.github/workflows/utils/region-tags-tests.sh
84 changes: 31 additions & 53 deletions .github/workflows/functions-concepts.yaml
Original file line number Diff line number Diff line change
@@ -1,79 +1,57 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: functions-concepts
on:
push:
branches:
- main
paths:
- 'functions/concepts/**'
- '.github/workflows/functions-concepts.yaml'
pull_request:
paths:
- 'functions/concepts/**'
- '.github/workflows/functions-concepts.yaml'
pull_request_target:
types: [labeled]
paths:
- 'functions/concepts/**'
- '.github/workflows/functions-concepts.yaml'
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: github.event.action != 'labeled' || github.event.label.name == 'actions:force-run'
strategy:
matrix:
# Each package in this list will be tested independently.
# New packages must be manually added to this list.
package:
path:
- 'functions/concepts/afterResponse'
- 'functions/concepts/afterTimeout'
- 'functions/concepts/backgroundTermination'
- 'functions/concepts/filesystem'
- 'functions/concepts/httpTermination'
- 'functions/concepts/requests'
- 'functions/concepts/stateless'
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: google-github-actions/[email protected]
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: '[email protected]'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3
with:
node-version: 14
- run: npm install
working-directory: ${{ matrix.package }}
- run: npm test -- --reporter xunit --reporter-option output=sponge_log.xml --reporter-option suiteName="${{ matrix.package }}"
working-directory: ${{ matrix.package }}
env:
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule' && always() }}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
- 'functions/concepts/stateless'
uses: ./.github/workflows/test.yaml
with:
name: 'functions-concepts'
path: '${{ matrix.path }}'
remove_label:
if: github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' && always()
uses: ./.github/workflows/remove-label.yaml
flakybot:
if: github.event_name == 'schedule' && always()
uses: ./.github/workflows/flakybot.yaml
needs: [test]
80 changes: 27 additions & 53 deletions .github/workflows/functions-helloworld.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: functions-helloworld
on:
push:
Expand All @@ -19,63 +33,23 @@ on:
- cron: '0 0 * * 0'
jobs:
test:
if: github.event.action != 'labeled' || github.event.label.name == 'actions:force-run'
strategy:
matrix:
# Each package in this list will be tested independently.
# New packages must be manually added to this list.
package:
path:
- 'functions/helloworld/helloError'
- 'functions/helloworld/helloGCS'
- 'functions/helloworld/helloPubSub'
- 'functions/helloworld/helloworldGet'
- 'functions/helloworld/helloworldHttp'
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/[email protected]
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/[email protected]'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: '[email protected]'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/[email protected]
with:
node-version: 16
- run: npm install
working-directory: ${{ matrix.package }}
- run: npm test -- --reporter xunit --reporter-option output=sponge_log.xml --reporter-option suiteName="${{ matrix.package }}"
working-directory: ${{ matrix.package }}
env:
MOCHA_REPORTER_SUITENAME: functions_helloworld
MOCHA_REPORTER_OUTPUT: functions_helloworld_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule' && always() }}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
uses: ./.github/workflows/test.yaml
with:
name: 'functions-helloworld'
path: '${{ matrix.path }}'
remove_label:
if: github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' && always()
uses: ./.github/workflows/remove-label.yaml
flakybot:
if: github.event_name == 'schedule' && always()
uses: ./.github/workflows/flakybot.yaml
needs: [test]
80 changes: 27 additions & 53 deletions .github/workflows/functions-http.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: functions-http
on:
push:
Expand All @@ -19,62 +33,22 @@ on:
- cron: '0 0 * * 0'
jobs:
test:
if: github.event.action != 'labeled' || github.event.label.name == 'actions:force-run'
strategy:
matrix:
# Each package in this list will be tested independently.
# New packages must be manually added to this list.
package:
path:
- 'functions/http/corsEnabledFunction'
- 'functions/http/corsEnabledFunctionAuth'
- 'functions/http/httpContent'
- 'functions/http/httpMethods'
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/[email protected]
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/[email protected]'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: '[email protected]'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/[email protected]
with:
node-version: 16
- run: npm install
working-directory: ${{ matrix.package }}
- run: npm test -- --reporter xunit --reporter-option output=sponge_log.xml --reporter-option suiteName="${{ matrix.package }}"
working-directory: ${{ matrix.package }}
env:
MOCHA_REPORTER_SUITENAME: functions_http
MOCHA_REPORTER_OUTPUT: functions_http_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule' && always() }}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
uses: ./.github/workflows/test.yaml
with:
name: 'functions-http'
path: '${{ matrix.path }}'
remove_label:
if: github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' && always()
uses: ./.github/workflows/remove-label.yaml
flakybot:
if: github.event_name == 'schedule' && always()
uses: ./.github/workflows/flakybot.yaml
needs: [test]
Loading