Skip to content

DO NOT MERGE: experiment with forked repos #42

DO NOT MERGE: experiment with forked repos

DO NOT MERGE: experiment with forked repos #42

Workflow file for this run

# Copyright 2024 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: custard CI
on:
push:
branches:
- main
pull_request:
# schedule:
# # https://crontab.guru/#0_12_*_*_0
# - cron: 0 12 * * 0 # At 12:00 on Sunday
jobs:
affected:
name: Find affected packages
# TODO: use version tag when available
uses: GoogleCloudPlatform/cloud-samples-tools/.github/workflows/find-affected.yaml@main
with:
config-file: .github/config/nodejs-prod.jsonc
paths: tpu # TODO: remove this
lint:
needs: affected
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version: 20
- run: npm install
- name: Run linter
# TODO: use version tag when available
uses: GoogleCloudPlatform/cloud-samples-tools/.github/map-run@main
with:
command: npx gts lint
paths: ${{ needs.affected.outputs.paths }}
region-tags:
name: region tags
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version: 20
- run: ./.github/workflows/utils/region-tags-tests.sh
test:
needs: affected
runs-on: ubuntu-latest
timeout-minutes: 120 # 2 hours hard limit
permissions:
id-token: write # for google-github-actions/auth
strategy:
fail-fast: false
matrix:
path: ${{ fromJson(needs.affected.outputs.paths) }}
# env:
# GOOGLE_SAMPLES_PROJECT: long-door-651
# GOOGLE_SERVICE_ACCOUNT: [email protected]
steps:
# - name: Setup Custard
# # TODO: use version tag when available
# uses: GoogleCloudPlatform/cloud-samples-tools/.github/setup-custard@main
# with:
# path: ${{ matrix.path }}
# ci-setup: ${{ toJson(fromJson(needs.affected.outputs.ci-setups)[matrix.path]) }}
# project-id: ${{ env.GOOGLE_SAMPLES_PROJECT }}
# workload-identity-provider: projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
# service-account: ${{ env.GOOGLE_SERVICE_ACCOUNT }}
# - name: Setup Node
# uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
# with:
# node-version: ${{ fromJson(needs.affected.outputs.ci-setups)[matrix.path].node-version }}
# - name: Run tests for ${{ matrix.path }}
# run: |
# timeout ${{ fromJson(needs.affected.outputs.ci-setups)[matrix.path].timeout-minutes }}m \
# make test dir=${{ matrix.path }}
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Save job inputs
run: |
mkdir -p artifact/
cat > artifact/inputs.json << EOF
{
"pull-request-number": ${{ github.event.number }},
"path": ${{ matrix.path }},
"ci-setup": ${{ toJson(fromJson(needs.affected.outputs.ci-setups)[matrix.path]) }}
}
EOF
- name: Upload inputs artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.pull_request.head.sha }}
path: artifact/
# - name: Upload test results for FlakyBot workflow
# if: github.event.action == 'schedule' && always() # always() submits logs even if tests fail
# uses: actions/upload-artifact@v4
# with:
# name: test-results
# path: ${{ matrix.package }}/${{ env.MOCHA_REPORTER_OUTPUT }}
# retention-days: 1