diff --git a/.github/workflows/ci-dev.yaml b/.github/workflows/custard-ci-dev.yaml similarity index 100% rename from .github/workflows/ci-dev.yaml rename to .github/workflows/custard-ci-dev.yaml diff --git a/.github/workflows/ci-prod.yaml b/.github/workflows/custard-ci.yaml similarity index 78% rename from .github/workflows/ci-prod.yaml rename to .github/workflows/custard-ci.yaml index 73b38ea62b..2e85d1218c 100644 --- a/.github/workflows/ci-prod.yaml +++ b/.github/workflows/custard-ci.yaml @@ -60,16 +60,51 @@ jobs: cat paths.txt echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs-prod.jsonc paths.txt)" >> $GITHUB_OUTPUT - nodejs-lint: - name: lint + lint: + needs: affected runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Setup Node + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 with: node-version: 20 - - run: make lint + - run: npm install + - name: Run lint + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + with: + script: | + const { execSync } = await import("node:child_process"); + + const cmd = 'npx gts lint'; + const affected = ${{ needs.affected.outputs.nodejs-paths }}; + if (affected.length === 0) { + console.log("No packages were affected, nothing to lint.") + } + + let failed = []; + for (const path of affected) { + try { + execSync(cmd, {cwd: path}); + console.log(`✅ [${path}]: ${cmd}`); + } catch (e) { + failed.push(path) + console.log(`❌ [${path}]: ${cmd} (exit code ${e.status})`); + core.error(e.message); + console.log('--- stdout ---'); + console.log(e.stdout.toString("utf8")); + console.log('--- stderr ---'); + console.log(e.stderr.toString("utf8")); + } + } + console.log("=== Summary ===") + console.log(` Passed: ${affected.length - failed.length}`) + console.log(` Failed: ${failed.length}`) + if (failed.length > 0) { + core.setFailed(`Failed '${cmd}' on: ${failed.join(', ')}`) + } region-tags: name: region tags @@ -82,8 +117,7 @@ jobs: node-version: 20 - run: ./.github/workflows/utils/region-tags-tests.sh - nodejs-test: - name: test + test: needs: affected runs-on: ubuntu-latest timeout-minutes: 120 # 2 hours hard limit