|
| 1 | +# Copyright 2023 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
1 | 15 | name: functions-concepts |
2 | 16 | on: |
3 | 17 | push: |
4 | 18 | branches: |
5 | 19 | - main |
6 | 20 | paths: |
7 | 21 | - 'functions/concepts/**' |
| 22 | + - '.github/workflows/functions-concepts.yaml' |
8 | 23 | pull_request: |
9 | 24 | paths: |
10 | 25 | - 'functions/concepts/**' |
| 26 | + - '.github/workflows/functions-concepts.yaml' |
11 | 27 | pull_request_target: |
12 | 28 | types: [labeled] |
13 | 29 | paths: |
14 | 30 | - 'functions/concepts/**' |
| 31 | + - '.github/workflows/functions-concepts.yaml' |
15 | 32 | schedule: |
16 | 33 | - cron: '0 0 * * 0' |
17 | 34 | jobs: |
18 | 35 | test: |
| 36 | + if: github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' |
19 | 37 | strategy: |
20 | 38 | matrix: |
21 | | - # Each package in this list will be tested independently. |
22 | | - # New packages must be manually added to this list. |
23 | | - package: |
| 39 | + path: |
24 | 40 | - 'functions/concepts/afterResponse' |
25 | 41 | - 'functions/concepts/afterTimeout' |
26 | 42 | - 'functions/concepts/backgroundTermination' |
27 | 43 | - 'functions/concepts/filesystem' |
28 | 44 | - 'functions/concepts/httpTermination' |
29 | 45 | - 'functions/concepts/requests' |
30 | | - - 'functions/concepts/stateless' |
31 | | - if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} |
32 | | - runs-on: ubuntu-latest |
33 | | - timeout-minutes: 60 |
34 | | - permissions: |
35 | | - contents: 'write' |
36 | | - pull-requests: 'write' |
37 | | - id-token: 'write' |
38 | | - steps: |
39 | | - - uses: actions/checkout@v3 |
40 | | - with: |
41 | | - ref: ${{github.event.pull_request.head.ref}} |
42 | | - repository: ${{github.event.pull_request.head.repo.full_name}} |
43 | | - - uses: google-github-actions/auth@v1.0.0 |
44 | | - with: |
45 | | - workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' |
46 | | - service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' |
47 | | - create_credentials_file: 'true' |
48 | | - access_token_lifetime: 600s |
49 | | - - uses: actions/setup-node@v3 |
50 | | - with: |
51 | | - node-version: 14 |
52 | | - - run: npm install |
53 | | - working-directory: ${{ matrix.package }} |
54 | | - - run: npm test -- --reporter xunit --reporter-option output=sponge_log.xml --reporter-option suiteName="${{ matrix.package }}" |
55 | | - working-directory: ${{ matrix.package }} |
56 | | - env: |
57 | | - MOCHA_REPORTER: xunit |
58 | | - - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} |
59 | | - uses: actions/github-script@v6 |
60 | | - with: |
61 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
62 | | - script: | |
63 | | - try { |
64 | | - await github.rest.issues.removeLabel({ |
65 | | - name: 'actions:force-run', |
66 | | - owner: 'GoogleCloudPlatform', |
67 | | - repo: 'nodejs-docs-samples', |
68 | | - issue_number: context.payload.pull_request.number |
69 | | - }); |
70 | | - } catch (e) { |
71 | | - if (!e.message.includes('Label does not exist')) { |
72 | | - throw e; |
73 | | - } |
74 | | - } |
75 | | - - if: ${{ github.event_name == 'schedule' && always() }} |
76 | | - run: | |
77 | | - curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L |
78 | | - chmod +x ./flakybot |
79 | | - ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} |
| 46 | + - 'functions/concepts/stateless' |
| 47 | + uses: ./.github/workflows/test.yaml |
| 48 | + with: |
| 49 | + name: 'functions-concepts' |
| 50 | + path: '${{ matrix.path }}' |
| 51 | + remove_label: |
| 52 | + if: github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' && always() |
| 53 | + uses: ./.github/workflows/remove-label.yaml |
| 54 | + flakybot: |
| 55 | + if: github.event_name == 'schedule' && always() |
| 56 | + uses: ./.github/workflows/flakybot.yaml |
| 57 | + needs: [test] |
0 commit comments