Skip to content

fix: testing-isolation excluded packages (#3935) #17

fix: testing-isolation excluded packages (#3935)

fix: testing-isolation excluded packages (#3935) #17

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: ⚗️ experimental
on:
push:
branches:
- main
pull_request:
# schedule:
# # https://crontab.guru/#0_12_*_*_0
# - cron: 0 12 * * 0 # At 12:00 on Sunday
env:
GO_VERSION: ^1.22.0
jobs:
affected:
name: Finding affected tests
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
nodejs: ${{ steps.nodejs.outputs.packages }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- run: go build -o ${{ github.workspace }}/tools ./cmd/...
working-directory: .github/cloud-samples-tools
- name: Get diffs
run: git --no-pager diff --name-only HEAD origin/main | tee diffs.txt
- name: Find Node.js affected packages
id: nodejs
run: echo "packages=$(./tools affected .github/config/nodejs.jsonc diffs.txt)" | tee -a $GITHUB_OUTPUT
nodejs-lint:
name: Node.js lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: make lint
- run: ./.github/workflows/utils/region-tags-tests.sh
nodejs-test:
name: Node.js 20 test
needs: affected
runs-on: ubuntu-latest
permissions:
id-token: write # needed for google-github-actions/auth
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(github.event_name == 'pull_request' && needs.affected.outputs.nodejs || '[]') }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: google-github-actions/auth@v2
with:
project_id: long-door-651
workload_identity_provider: projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
service_account: kokoro-system-test@long-door-651.iam.gserviceaccount.com
access_token_lifetime: 600s # 10 minutes
- name: Test ${{ matrix.package }}
run: |
npm install
bash .github/scripts/nodejs-test.sh ${{ matrix.package }}
env:
GOOGLE_SAMPLES_PROJECT: long-door-651