Skip to content

Commit 9617042

Browse files
sofislTakashi Matsuo
andauthored
build: move run/system-package to GH Actions (GoogleCloudPlatform#2526)
* build: move run/system-package to GH Actions * try * try * try * fix: istall graphviz * try reinstalling * fix * fix * fix: other changes Co-authored-by: Takashi Matsuo <tmatsuo@google.com>
1 parent 163923c commit 9617042

4 files changed

Lines changed: 73 additions & 11 deletions

File tree

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

.github/workflows/workflows.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
"monitoring/prometheus",
4141
"datacatalog/cloud-client",
4242
"datacatalog/quickstart",
43-
"datastore/functions",
43+
"datastore/functions",
4444
"run/helloworld",
4545
"run/image-processing",
46-
"run/idp-sql"
47-
]
46+
"run/idp-sql",
47+
"run/system-package"
48+
]

.kokoro/run/system-package.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

run/system-package/test/system.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
const assert = require('assert');
1616
const got = require('got');
1717
const {execSync} = require('child_process');
18-
const {GoogleAuth} = require('google-auth-library');
1918
const auth = new GoogleAuth();
19+
const {GoogleAuth} = require('google-auth-library');
2020

2121
const request = (method, route, base_url, id_token) => {
2222
return got(new URL(route, base_url.trim()), {

0 commit comments

Comments
 (0)