Skip to content

Commit fd8b881

Browse files
authored
Merge branch 'main' into renovate/all
2 parents cac4ef3 + 7de4517 commit fd8b881

File tree

20 files changed

+455
-34
lines changed

20 files changed

+455
-34
lines changed

.github/config/nodejs-dev.jsonc

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100
"auth",
101101
"batch",
102102
"cloud-language",
103+
"cloud-sql/mysql/mysql",
104+
"cloud-sql/mysql/mysql2",
105+
"cloud-sql/postgres/knex",
103106
"cloud-tasks/snippets",
104107
"cloud-tasks/tutorial-gcf/app",
105108
"cloud-tasks/tutorial-gcf/function",

.github/config/nodejs-prod.jsonc renamed to .github/config/nodejs.jsonc

-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@
7777
// TODO: fix these
7878
"ai-platform/snippets", // PERMISSION_DENIED: Permission denied: Consumer 'projects/undefined' has been suspended.
7979
"automl", // (untested) FAILED_PRECONDITION: Google Cloud AutoML Natural Language was retired on March 15, 2024. Please migrate to Vertex AI instead
80-
"cloud-sql/mysql/mysql", // (untested) Error: expected 200 "OK", got 500 "Internal Server Error"
81-
"cloud-sql/mysql/mysql2", // (untested) Error: Cannot find module './connect-connector-with-iam-authn.js'
82-
"cloud-sql/postgres/knex", // (untested) CloudSQLConnectorError: Malformed instance connection name provided: expected format of "PROJECT:REGION:INSTANCE", got undefined
8380
"cloud-sql/sqlserver/mssql", // (untested) TypeError: The "config.server" property is required and must be of type string.
8481
"cloud-sql/sqlserver/tedious", // (untested) TypeError: The "config.server" property is required and must be of type string.
8582
"compute", // GoogleError: The resource 'projects/long-door-651/zones/us-central1-a/disks/disk-from-pool-name' was not found

.github/workflows/custard-ci-dev.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: custard CI (dev)
15+
name: Custard CI (dev)
1616
on:
1717
push:
1818
branches:

.github/workflows/custard-ci.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: custard CI
15+
name: Custard CI
1616
on:
1717
push:
1818
branches:
@@ -25,6 +25,7 @@ on:
2525
env:
2626
GO_VERSION: ^1.22.0
2727

28+
# TODO: remove all jobs except region-tags (should be tested by custard-run workflows)
2829
jobs:
2930
affected:
3031
name: Finding affected tests
@@ -56,9 +57,9 @@ jobs:
5657
- name: Find Node.js affected packages
5758
id: nodejs
5859
run: |
59-
echo "paths=$(./cloud-samples-tools/bin/custard affected .github/config/nodejs-prod.jsonc diffs.txt paths.txt)" >> $GITHUB_OUTPUT
60+
echo "paths=$(./cloud-samples-tools/bin/custard affected .github/config/nodejs.jsonc diffs.txt paths.txt)" >> $GITHUB_OUTPUT
6061
cat paths.txt
61-
echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs-prod.jsonc paths.txt)" >> $GITHUB_OUTPUT
62+
echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs.jsonc paths.txt)" >> $GITHUB_OUTPUT
6263
6364
lint:
6465
needs: affected
+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Copyright 2024 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+
15+
name: (experimental / dev) Custard run
16+
17+
on:
18+
# Run tests when a pull request is created or updated.
19+
# This allows to run tests from forked repos (after reviewer's approval).
20+
workflow_run:
21+
workflows:
22+
- Custard CI # .github/workflows/custard-ci.yaml
23+
types:
24+
- in_progress
25+
26+
# Run tests again as validation when a PR merge into main.
27+
push:
28+
branches:
29+
- main
30+
31+
# To do manual runs through the Actions UI.
32+
workflow_dispatch:
33+
inputs:
34+
run-all:
35+
description: Run all tests
36+
type: boolean
37+
default: false
38+
paths:
39+
description: Comma separated packages to test
40+
type: string
41+
ref:
42+
description: Branch, tag, or commit SHA to run tests on
43+
type: string
44+
default: main
45+
46+
jobs:
47+
affected:
48+
uses: GoogleCloudPlatform/cloud-samples-tools/.github/workflows/[email protected]
49+
permissions:
50+
statuses: write
51+
with:
52+
head-sha: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
53+
config-file: .github/config/nodejs-dev.jsonc
54+
paths: ${{ (inputs.run-all && '.') || inputs.paths || '' }}
55+
check-name: (experimental / dev) Custard CI
56+
create-check-if: ${{ !!github.event.workflow_run }}
57+
58+
test:
59+
if: needs.affected.outputs.paths != '[]'
60+
needs: affected
61+
runs-on: ubuntu-latest
62+
timeout-minutes: 120 # 2 hours hard limit
63+
permissions:
64+
id-token: write
65+
statuses: write
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
path: ${{ needs.affected.outputs.paths }}
70+
continue-on-error: true
71+
env:
72+
GOOGLE_SAMPLES_PROJECT: long-door-651
73+
GOOGLE_SERVICE_ACCOUNT: [email protected]
74+
steps:
75+
- name: Check queued
76+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
77+
id: queued
78+
with:
79+
sha: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
80+
name: (experimental / dev) Custard CI / ${{ github.job }} (${{ matrix.path }})
81+
job-name: ${{ github.job }} (${{ matrix.path }})
82+
if: ${{ !!github.event.workflow_run }}
83+
- name: Setup Custard
84+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
85+
with:
86+
path: ${{ matrix.path }}
87+
ci-setup: ${{ toJson(fromJson(needs.affected.outputs.ci-setups)[matrix.path]) }}
88+
project-id: ${{ env.GOOGLE_SAMPLES_PROJECT }}
89+
workload-identity-provider: projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
90+
service-account: ${{ env.GOOGLE_SERVICE_ACCOUNT }}
91+
- name: Check in_progress
92+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
93+
id: in_progress
94+
with:
95+
check: ${{ steps.queued.outputs.check }}
96+
status: in_progress
97+
- name: Run tests for ${{ matrix.path }}
98+
run: |
99+
timeout ${{ fromJson(needs.affected.outputs.ci-setups)[matrix.path].timeout-minutes }}m \
100+
make test dir=${{ matrix.path }}
101+
- name: Check success
102+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
103+
with:
104+
check: ${{ steps.in_progress.outputs.check }}
105+
status: success
106+
- name: Check failure
107+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
108+
if: failure()
109+
with:
110+
check: ${{ steps.in_progress.outputs.check }}
111+
status: failure
112+
113+
done:
114+
needs: [affected, test]
115+
if: always()
116+
runs-on: ubuntu-latest
117+
permissions:
118+
statuses: write
119+
steps:
120+
- name: Check success
121+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
122+
with:
123+
check: ${{ needs.affected.outputs.check }}
124+
status: success

.github/workflows/custard-run.yaml

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Copyright 2024 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+
15+
name: (experimental) Custard run
16+
17+
on:
18+
# Run tests when a pull request is created or updated.
19+
# This allows to run tests from forked repos (after reviewer's approval).
20+
workflow_run:
21+
workflows:
22+
- Custard CI # .github/workflows/custard-ci.yaml
23+
types:
24+
- in_progress
25+
26+
# Run tests again as validation when a PR merge into main.
27+
push:
28+
branches:
29+
- main
30+
31+
# To do manual runs through the Actions UI.
32+
workflow_dispatch:
33+
inputs:
34+
run-all:
35+
description: Run all tests
36+
type: boolean
37+
default: false
38+
paths:
39+
description: Comma separated packages to test
40+
type: string
41+
ref:
42+
description: Branch, tag, or commit SHA to run tests on
43+
type: string
44+
default: main
45+
46+
# For nightly tests.
47+
# schedule:
48+
# # https://crontab.guru/#0_12_*_*_0
49+
# - cron: 0 12 * * 0 # At 12:00 on Sunday
50+
51+
jobs:
52+
affected:
53+
uses: GoogleCloudPlatform/cloud-samples-tools/.github/workflows/[email protected]
54+
permissions:
55+
statuses: write
56+
with:
57+
head-sha: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
58+
config-file: .github/config/nodejs.jsonc
59+
paths: ${{ (inputs.run-all && '.') || inputs.paths || '' }}
60+
check-name: (experimental) Custard CI
61+
create-check-if: ${{ !!github.event.workflow_run }}
62+
63+
lint:
64+
needs: affected
65+
runs-on: ubuntu-latest
66+
permissions:
67+
statuses: write
68+
timeout-minutes: 5
69+
steps:
70+
- name: Check in_progress
71+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
72+
id: in_progress
73+
with:
74+
sha: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
75+
status: in_progress
76+
name: (experimental) Custard CI / ${{ github.job }}
77+
if: ${{ !!github.event.workflow_run }}
78+
- name: Checkout
79+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
80+
- name: Setup Node
81+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
82+
with:
83+
node-version: 20
84+
- run: npm install
85+
- name: npx gtx lint (${{ needs.affected.outputs.num-paths }} packages)
86+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
87+
with:
88+
command: npx gts lint
89+
paths: ${{ needs.affected.outputs.paths }}
90+
- name: Check success
91+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
92+
with:
93+
check: ${{ steps.in_progress.outputs.check }}
94+
status: success
95+
- name: Check failure
96+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
97+
if: failure()
98+
with:
99+
check: ${{ steps.in_progress.outputs.check }}
100+
status: failure
101+
102+
test:
103+
if: needs.affected.outputs.paths != '[]'
104+
needs: affected
105+
runs-on: ubuntu-latest
106+
timeout-minutes: 120 # 2 hours hard limit
107+
permissions:
108+
id-token: write
109+
statuses: write
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
path: ${{ fromJson(needs.affected.outputs.paths) }}
114+
continue-on-error: true
115+
env:
116+
GOOGLE_SAMPLES_PROJECT: long-door-651
117+
GOOGLE_SERVICE_ACCOUNT: [email protected]
118+
steps:
119+
- name: Check queued
120+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
121+
id: queued
122+
with:
123+
sha: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
124+
name: (experimental) Custard CI / ${{ github.job }} (${{ matrix.path }})
125+
job-name: ${{ github.job }} (${{ matrix.path }})
126+
if: ${{ !!github.event.workflow_run }}
127+
- name: Setup Custard
128+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
129+
with:
130+
path: ${{ matrix.path }}
131+
ci-setup: ${{ toJson(fromJson(needs.affected.outputs.ci-setups)[matrix.path]) }}
132+
project-id: ${{ env.GOOGLE_SAMPLES_PROJECT }}
133+
workload-identity-provider: projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
134+
service-account: ${{ env.GOOGLE_SERVICE_ACCOUNT }}
135+
- name: Check in_progress
136+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
137+
id: in_progress
138+
with:
139+
check: ${{ steps.queued.outputs.check }}
140+
status: in_progress
141+
- name: Run tests for ${{ matrix.path }}
142+
run: |
143+
timeout ${{ fromJson(needs.affected.outputs.ci-setups)[matrix.path].timeout-minutes }}m \
144+
make test dir=${{ matrix.path }}
145+
- name: Check success
146+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
147+
with:
148+
check: ${{ steps.in_progress.outputs.check }}
149+
status: success
150+
- name: Check failure
151+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
152+
if: failure()
153+
with:
154+
check: ${{ steps.in_progress.outputs.check }}
155+
status: failure
156+
157+
done:
158+
needs: [affected, lint, test]
159+
if: always()
160+
runs-on: ubuntu-latest
161+
permissions:
162+
statuses: write
163+
steps:
164+
- name: Check success
165+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/[email protected]
166+
with:
167+
check: ${{ needs.affected.outputs.check }}
168+
status: success

0 commit comments

Comments
 (0)