Skip to content

Commit 7590080

Browse files
ericschmidtatworkAce Nassri
authored andcommitted
Add workflow file for running tests
1 parent da87b76 commit 7590080

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: functions-memorystore
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'functions/memorystore/redis/**'
8+
pull_request:
9+
paths:
10+
- 'functions/memorystore/redis/**'
11+
pull_request_target:
12+
types: [labeled]
13+
schedule:
14+
- cron: '0 0 * * 0'
15+
jobs:
16+
test:
17+
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 60
20+
permissions:
21+
contents: 'write'
22+
pull-requests: 'write'
23+
id-token: 'write'
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
ref: ${{github.event.pull_request.head.ref}}
28+
repository: ${{github.event.pull_request.head.repo.full_name}}
29+
- uses: google-github-actions/auth@v1.0.0
30+
with:
31+
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
32+
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
33+
create_credentials_file: 'true'
34+
access_token_lifetime: 600s
35+
- uses: actions/setup-node@v3
36+
with:
37+
node-version: 14
38+
- run: npm install
39+
working-directory: functions/memorystore/redis
40+
- run: npm test
41+
working-directory: functions/memorystore/redis
42+
env:
43+
MOCHA_REPORTER_SUITENAME: functions_memorystore
44+
MOCHA_REPORTER_OUTPUT: functions_memorystore_sponge_log.xml
45+
MOCHA_REPORTER: xunit
46+
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
47+
uses: actions/github-script@v6
48+
with:
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
script: |
51+
try {
52+
await github.rest.issues.removeLabel({
53+
name: 'actions:force-run',
54+
owner: 'GoogleCloudPlatform',
55+
repo: 'nodejs-docs-samples',
56+
issue_number: context.payload.pull_request.number
57+
});
58+
} catch (e) {
59+
if (!e.message.includes('Label does not exist')) {
60+
throw e;
61+
}
62+
}
63+
- if: ${{ github.event_name == 'schedule' && always() }}
64+
run: |
65+
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
66+
chmod +x ./flakybot
67+
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

0 commit comments

Comments
 (0)