diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index cfbc34c8e4..869beb121b 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Build Check (Run npm run build everywhere locally if this fails) @@ -22,21 +11,24 @@ env: jobs: build: - name: Run build tasks + name: Run build tasks (Node ${{ matrix.node-version }}) runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['20', '21', '22'] steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v3 - - name: Set up node v20 - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: pnpm - - name: Install dependencies - run: pnpm install - - name: Run build script - run: pnpm build - - name: Run js tests - run: pnpm test:js - - name: Validate working directory is clean - run: .github/workflows/scripts/ensure-clean-working-tree.sh + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v3 + - name: Set up node v${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + - name: Install dependencies + run: pnpm install + - name: Run build script + run: pnpm build + - name: Run js tests + run: pnpm test:js + - name: Validate working directory is clean + run: .github/workflows/scripts/ensure-clean-working-tree.sh diff --git a/.github/workflows/bump-cli-version.yml b/.github/workflows/bump-cli-version.yml index ff59e7548e..275e5e3c93 100644 --- a/.github/workflows/bump-cli-version.yml +++ b/.github/workflows/bump-cli-version.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Bump and Tag CLI Version diff --git a/.github/workflows/bump-js-version.yml b/.github/workflows/bump-js-version.yml index 5386dcb756..3c1c042021 100644 --- a/.github/workflows/bump-js-version.yml +++ b/.github/workflows/bump-js-version.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Bump and Tag JS Version diff --git a/.github/workflows/bump-package-version.yml b/.github/workflows/bump-package-version.yml index 628dbbae20..e1dd3c0bfb 100644 --- a/.github/workflows/bump-package-version.yml +++ b/.github/workflows/bump-package-version.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Bump Version for a package diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 0153a2ff1d..3211582949 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Run e2e tests @@ -21,15 +10,18 @@ on: jobs: build: - name: Run e2e tests + name: Run e2e tests (Node ${{ matrix.node-version }}) runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['20', '21', '22'] steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v3 - - name: Set up node v20 + - name: Set up node v${{ matrix.node-version }} uses: actions/setup-node@v4 with: - node-version: 20.x + node-version: ${{ matrix.node-version }} cache: pnpm - name: Install dependencies run: pnpm install diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 6921fa5fd0..0182ea223b 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Formatting Check (Run npm run format locally if this fails) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 950feea21b..694048c6ad 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Go tests and checks diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 4cb0e98cb2..9c80151080 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: python-version: - - "3.12" + - "3.12" # uv manages versions; this is base. steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release_js_main.yml b/.github/workflows/release_js_main.yml index 31590b3346..cd2ade76e8 100644 --- a/.github/workflows/release_js_main.yml +++ b/.github/workflows/release_js_main.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Release Genkit JS diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml index f44f7588f8..69b6a75443 100644 --- a/.github/workflows/samples.yml +++ b/.github/workflows/samples.yml @@ -1,20 +1,9 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Build Samples (only runs if /samples/** is changed) -on: +on: pull_request: paths: samples/** @@ -24,19 +13,22 @@ env: jobs: build: - name: Build Samples + name: Build Samples (Node ${{ matrix.node-version }}) runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['20', '21', '22'] steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v3 - - name: Set up node v20 - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: pnpm - - name: Install dependencies - run: pnpm install - - name: Build Samples - run: pnpm build:js-samples - - name: Validate working directory is clean - run: .github/workflows/scripts/ensure-clean-working-tree.sh + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v3 + - name: Set up node v${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + - name: Install dependencies + run: pnpm install + - name: Build Samples + run: pnpm build:js-samples + - name: Validate working directory is clean + run: .github/workflows/scripts/ensure-clean-working-tree.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 896d284f7c..35f6244e8b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,16 +1,5 @@ # 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. +# SPDX-License-Identifier: Apache-2.0 name: Run Tests @@ -24,15 +13,18 @@ jobs: build: name: Run Tests (just DevUI tests for now) runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['20', '21', '22'] steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v3 - - name: Set up node v20 - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: pnpm - - name: Install dependencies and build - run: pnpm build:genkit-tools - - name: Run tests - run: pnpm test:genkit-tools + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v3 + - name: Set up node v${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + - name: Install dependencies and build + run: pnpm build:genkit-tools + - name: Run tests + run: pnpm test:genkit-tools diff --git a/bin/add_license b/bin/add_license index e8fdb9a16a..5bc5e78e24 100755 --- a/bin/add_license +++ b/bin/add_license @@ -42,6 +42,7 @@ $HOME/go/bin/addlicense \ -ignore '**/dist/**/*' \ -ignore '**/node_modules/**/*' \ -ignore '**/pnpm-lock.yaml' \ + -ignore '**/py/site/**/*.html' \ -ignore '.nx/**/*' \ -ignore '.trunk/**/*' \ "$TOP_DIR" diff --git a/bin/check_license b/bin/check_license index c48621876f..a9f6ec1fbc 100755 --- a/bin/check_license +++ b/bin/check_license @@ -45,6 +45,7 @@ $HOME/go/bin/addlicense \ -ignore '**/dist/**/*' \ -ignore '**/node_modules/**/*' \ -ignore '**/pnpm-lock.yaml' \ + -ignore '**/py/site/**/*.html' \ -ignore '.nx/**/*' \ -ignore '.trunk/**/*' \ "$TOP_DIR" diff --git a/bin/fmt b/bin/fmt index 4e92254c76..3415f09be9 100755 --- a/bin/fmt +++ b/bin/fmt @@ -39,13 +39,9 @@ fi popd # Format all TypeScript code. -# -# TODO: Re-enable once we have biome configured and enabled because that is -# several times faster and compatible. -# -#pushd ${TOP_DIR} -#pnpm run format -#if [[ $? -ne 0 ]]; then -# exit 1 -#fi -#popd +pushd ${TOP_DIR} +pnpm run format +if [[ $? -ne 0 ]]; then + exit 1 +fi +popd diff --git a/bin/setup b/bin/setup index 2c7ceb3a43..3594a13f8e 100755 --- a/bin/setup +++ b/bin/setup @@ -24,7 +24,7 @@ fi TOP_DIR=$(git rev-parse --show-toplevel) PNPM_VERSION="10.2.0" -NODE_VERSION="23" +NODE_VERSION="22" # See: https://github.com/firebase/genkit/issues/1995 NVM_VERSION="0.40.1" AUDIENCE="eng" diff --git a/biome.json b/biome.json index c89309e043..b87d6b7b75 100644 --- a/biome.json +++ b/biome.json @@ -31,7 +31,10 @@ ".nx/**", ".trunk/**", "bazel-*/**", + "genkit-tools/genkit-schema.json", + "go/**", "node_modules/**", + "py/**", "third_party/**" ] }, @@ -46,7 +49,7 @@ }, "javascript": { "formatter": { - "arrowParentheses": "asNeeded", + "arrowParentheses": "always", "attributePosition": "auto", "bracketSpacing": true, "jsxQuoteStyle": "double", diff --git a/captainhook.json b/captainhook.json index 8f460291d9..2154c2d31c 100644 --- a/captainhook.json +++ b/captainhook.json @@ -39,6 +39,9 @@ { "run": "bin/fmt" }, + { + "run": "pnpm run format:check" + }, { "run": "uv run --directory py ruff check --fix ." }, @@ -79,6 +82,9 @@ { "run": "bin/fmt" }, + { + "run": "pnpm run format:check" + }, { "run": "uv run --directory py ruff check --fix ." }, diff --git a/package.json b/package.json index fb14278ec8..b5111ddd6b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "setup": "npm-run-all pnpm-install-js pnpm-install-genkit-tools build link-genkit-cli", "format": "(prettier . --write) && (tsx scripts/copyright.ts)", "format:check": "(prettier . --check) && (tsx scripts/copyright.ts --check)", - "format:todo": "pnpm dlx @biomejs/biome format --write .", + "format:biome": "pnpm dlx @biomejs/biome check --formatter-enabled=true --linter-enabled=false --organize-imports-enabled=true --fix . && bin/add_license", + "lint:biome": "pnpm dlx @biomejs/biome lint --fix . && bin/add_license", + "format:biome-check": "pnpm dlx @biomejs/biome ci --linter-enabled=false --formatter-enabled=true --organize-imports-enabled=false . && bin/check_license", "build": "pnpm build:js && pnpm build:genkit-tools", "build:js": "cd js && pnpm i && pnpm build", "build:genkit-tools": "cd genkit-tools && pnpm i && pnpm build",