diff --git a/.github/workflows/lint-typescript.yml b/.github/workflows/lint-typescript.yml new file mode 100644 index 0000000..a4e46d1 --- /dev/null +++ b/.github/workflows/lint-typescript.yml @@ -0,0 +1,92 @@ +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: MIT + +name: Type checking + +on: + workflow_call: + +permissions: + contents: read + +concurrency: + group: lint-typescript-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + src: ${{ steps.changes.outputs.src }} + steps: + - name: Detect TypeScript changes + id: changes + uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '**.ts' + - '**.vue' + + test: + runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.src != 'false' + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Read package.json engines + id: versions + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 + with: + fallbackNode: '^24' + fallbackNpm: '^11.3' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Show npm version + run: npm --version + + - name: Install dependencies + env: + CYPRESS_INSTALL_BINARY: 0 + run: npm ci + + - name: Check types + run: | + npm run --if-present check-types + npm run --if-present ts:check + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: + - changes + - test + if: always() + name: typescript-summary + steps: + - name: Summary status + env: + CHANGED: ${{ needs.changes.outputs.src }} + TEST_RESULT: ${{ needs.test.result }} + run: | + if [ "$CHANGED" != "false" ] && [ "$TEST_RESULT" != "success" ]; then + exit 1 + fi diff --git a/.github/workflows/node-test.yml b/.github/workflows/node-test.yml new file mode 100644 index 0000000..d9406d4 --- /dev/null +++ b/.github/workflows/node-test.yml @@ -0,0 +1,105 @@ +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: MIT + +name: Node tests + +on: + workflow_call: + +permissions: + contents: read + +concurrency: + group: node-tests-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + src: ${{ steps.changes.outputs.src }} + steps: + - name: Detect Node test changes + id: changes + uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - '__tests__/**' + - '__mocks__/**' + - 'src/**' + - 'appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '**.js' + - '**.ts' + - '**.vue' + + test: + runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.src != 'false' + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Read package.json engines + id: versions + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 + with: + fallbackNode: '^24' + fallbackNpm: '^11.3' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Show npm version + run: npm --version + + - name: Install dependencies and build + env: + CYPRESS_INSTALL_BINARY: 0 + run: | + npm ci + npm run build --if-present + + - name: Test + run: npm run test --if-present + + - name: Test and process coverage + run: npm run test:coverage --if-present + + - name: Collect coverage + uses: codecov/codecov-action@0b35c9ecc4f0529d0eb674914510c22f85b196b4 # v7.1.0 + with: + files: ./coverage/lcov.info + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: + - changes + - test + if: always() + name: test-summary + steps: + - name: Summary status + env: + CHANGED: ${{ needs.changes.outputs.src }} + TEST_RESULT: ${{ needs.test.result }} + run: | + if [ "$CHANGED" != "false" ] && [ "$TEST_RESULT" != "success" ]; then + exit 1 + fi diff --git a/patches/nextcloud/lint-typescript.yml.patch b/patches/nextcloud/lint-typescript.yml.patch new file mode 100644 index 0000000..8266c22 --- /dev/null +++ b/patches/nextcloud/lint-typescript.yml.patch @@ -0,0 +1,195 @@ +--- upstream/vendor/nextcloud/lint-typescript.yml ++++ .github/workflows/lint-typescript.yml +@@ -1,100 +1,92 @@ +-# This workflow is provided via the organization template repository +-# +-# https://github.com/nextcloud/.github +-# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +-# +-# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +-# SPDX-License-Identifier: MIT +- +-name: Type checking +- +-on: +- pull_request: +- push: +- branches: +- - main +- - master +- - stable* +- +-permissions: +- contents: read +- +-concurrency: +- group: lint-typescript-${{ github.head_ref || github.run_id }} +- cancel-in-progress: true +- +-jobs: +- changes: +- runs-on: ubuntu-latest-low +- permissions: +- contents: read +- pull-requests: read +- +- outputs: +- src: ${{ steps.changes.outputs.src}} +- +- steps: +- - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 +- id: changes +- continue-on-error: true +- with: +- filters: | +- src: +- - '.github/workflows/lint-typescript.yml' +- - 'package.json' +- - 'package-lock.json' +- - 'tsconfig.json' +- - '**.ts' +- - '**.vue' +- +- test: +- runs-on: ubuntu-latest +- +- needs: changes +- if: needs.changes.outputs.src != 'false' +- +- steps: +- - name: Checkout +- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 +- with: +- persist-credentials: false +- +- - name: Read package.json node and npm engines version +- uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 +- id: versions +- with: +- fallbackNode: '^24' +- fallbackNpm: '^11.3' +- +- - name: Set up node ${{ steps.versions.outputs.nodeVersion }} +- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 +- with: +- node-version: ${{ steps.versions.outputs.nodeVersion }} +- +- - name: Set up npm ${{ steps.versions.outputs.npmVersion }} +- run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' +- +- - name: Install dependencies +- env: +- CYPRESS_INSTALL_BINARY: 0 +- run: | +- npm ci +- +- - name: Check types +- run: | +- npm run --if-present check-types +- npm run --if-present ts:check +- +- summary: +- permissions: +- contents: none +- runs-on: ubuntu-latest-low +- needs: [changes, test] +- +- if: always() +- +- name: typescript-summary +- +- steps: +- - name: Summary status +- run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi ++# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors ++# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors ++# SPDX-License-Identifier: MIT ++ ++name: Type checking ++ ++on: ++ workflow_call: ++ ++permissions: ++ contents: read ++ ++concurrency: ++ group: lint-typescript-${{ github.head_ref || github.run_id }} ++ cancel-in-progress: true ++ ++jobs: ++ changes: ++ runs-on: ubuntu-latest ++ permissions: ++ contents: read ++ pull-requests: read ++ outputs: ++ src: ${{ steps.changes.outputs.src }} ++ steps: ++ - name: Detect TypeScript changes ++ id: changes ++ uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 ++ continue-on-error: true ++ with: ++ filters: | ++ src: ++ - '.github/workflows/**' ++ - 'package.json' ++ - 'package-lock.json' ++ - 'tsconfig.json' ++ - '**.ts' ++ - '**.vue' ++ ++ test: ++ runs-on: ubuntu-latest ++ needs: changes ++ if: needs.changes.outputs.src != 'false' ++ steps: ++ - name: Checkout ++ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 ++ with: ++ persist-credentials: false ++ ++ - name: Read package.json engines ++ id: versions ++ uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 ++ with: ++ fallbackNode: '^24' ++ fallbackNpm: '^11.3' ++ ++ - name: Set up node ${{ steps.versions.outputs.nodeVersion }} ++ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 ++ with: ++ node-version: ${{ steps.versions.outputs.nodeVersion }} ++ ++ - name: Show npm version ++ run: npm --version ++ ++ - name: Install dependencies ++ env: ++ CYPRESS_INSTALL_BINARY: 0 ++ run: npm ci ++ ++ - name: Check types ++ run: | ++ npm run --if-present check-types ++ npm run --if-present ts:check ++ ++ summary: ++ permissions: ++ contents: none ++ runs-on: ubuntu-latest ++ needs: ++ - changes ++ - test ++ if: always() ++ name: typescript-summary ++ steps: ++ - name: Summary status ++ env: ++ CHANGED: ${{ needs.changes.outputs.src }} ++ TEST_RESULT: ${{ needs.test.result }} ++ run: | ++ if [ "$CHANGED" != "false" ] && [ "$TEST_RESULT" != "success" ]; then ++ exit 1 ++ fi diff --git a/patches/nextcloud/node-test.yml.patch b/patches/nextcloud/node-test.yml.patch new file mode 100644 index 0000000..2757cd6 --- /dev/null +++ b/patches/nextcloud/node-test.yml.patch @@ -0,0 +1,220 @@ +--- upstream/vendor/nextcloud/node-test.yml ++++ .github/workflows/node-test.yml +@@ -1,112 +1,105 @@ +-# This workflow is provided via the organization template repository +-# +-# https://github.com/nextcloud/.github +-# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +-# +-# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +-# SPDX-License-Identifier: MIT +- +-name: Node tests +- +-on: +- pull_request: +- push: +- branches: +- - main +- - master +- - stable* +- +-permissions: +- contents: read +- +-concurrency: +- group: node-tests-${{ github.head_ref || github.run_id }} +- cancel-in-progress: true +- +-jobs: +- changes: +- runs-on: ubuntu-latest-low +- permissions: +- contents: read +- pull-requests: read +- +- outputs: +- src: ${{ steps.changes.outputs.src}} +- +- steps: +- - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 +- id: changes +- continue-on-error: true +- with: +- filters: | +- src: +- - '.github/workflows/**' +- - '__tests__/**' +- - '__mocks__/**' +- - 'src/**' +- - 'appinfo/info.xml' +- - 'package.json' +- - 'package-lock.json' +- - 'tsconfig.json' +- - '**.js' +- - '**.ts' +- - '**.vue' +- +- test: +- runs-on: ubuntu-latest +- +- needs: changes +- if: needs.changes.outputs.src != 'false' +- +- steps: +- - name: Checkout +- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 +- with: +- persist-credentials: false +- +- - name: Read package.json node and npm engines version +- uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 +- id: versions +- with: +- fallbackNode: '^24' +- fallbackNpm: '^11.3' +- +- - name: Set up node ${{ steps.versions.outputs.nodeVersion }} +- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 +- with: +- node-version: ${{ steps.versions.outputs.nodeVersion }} +- +- - name: Set up npm ${{ steps.versions.outputs.npmVersion }} +- run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' +- +- - name: Install dependencies & build +- env: +- CYPRESS_INSTALL_BINARY: 0 +- run: | +- npm ci +- npm run build --if-present +- +- - name: Test +- run: npm run test --if-present +- +- - name: Test and process coverage +- run: npm run test:coverage --if-present +- +- - name: Collect coverage +- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 +- with: +- files: ./coverage/lcov.info +- +- summary: +- permissions: +- contents: none +- runs-on: ubuntu-latest-low +- needs: [changes, test] +- +- if: always() +- +- name: test-summary +- +- steps: +- - name: Summary status +- run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi ++# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors ++# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors ++# SPDX-License-Identifier: MIT ++ ++name: Node tests ++ ++on: ++ workflow_call: ++ ++permissions: ++ contents: read ++ ++concurrency: ++ group: node-tests-${{ github.head_ref || github.run_id }} ++ cancel-in-progress: true ++ ++jobs: ++ changes: ++ runs-on: ubuntu-latest ++ permissions: ++ contents: read ++ pull-requests: read ++ outputs: ++ src: ${{ steps.changes.outputs.src }} ++ steps: ++ - name: Detect Node test changes ++ id: changes ++ uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 ++ continue-on-error: true ++ with: ++ filters: | ++ src: ++ - '.github/workflows/**' ++ - '__tests__/**' ++ - '__mocks__/**' ++ - 'src/**' ++ - 'appinfo/info.xml' ++ - 'package.json' ++ - 'package-lock.json' ++ - 'tsconfig.json' ++ - '**.js' ++ - '**.ts' ++ - '**.vue' ++ ++ test: ++ runs-on: ubuntu-latest ++ needs: changes ++ if: needs.changes.outputs.src != 'false' ++ steps: ++ - name: Checkout ++ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 ++ with: ++ persist-credentials: false ++ ++ - name: Read package.json engines ++ id: versions ++ uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 ++ with: ++ fallbackNode: '^24' ++ fallbackNpm: '^11.3' ++ ++ - name: Set up node ${{ steps.versions.outputs.nodeVersion }} ++ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 ++ with: ++ node-version: ${{ steps.versions.outputs.nodeVersion }} ++ ++ - name: Show npm version ++ run: npm --version ++ ++ - name: Install dependencies and build ++ env: ++ CYPRESS_INSTALL_BINARY: 0 ++ run: | ++ npm ci ++ npm run build --if-present ++ ++ - name: Test ++ run: npm run test --if-present ++ ++ - name: Test and process coverage ++ run: npm run test:coverage --if-present ++ ++ - name: Collect coverage ++ uses: codecov/codecov-action@0b35c9ecc4f0529d0eb674914510c22f85b196b4 # v7.1.0 ++ with: ++ files: ./coverage/lcov.info ++ ++ summary: ++ permissions: ++ contents: none ++ runs-on: ubuntu-latest ++ needs: ++ - changes ++ - test ++ if: always() ++ name: test-summary ++ steps: ++ - name: Summary status ++ env: ++ CHANGED: ${{ needs.changes.outputs.src }} ++ TEST_RESULT: ${{ needs.test.result }} ++ run: | ++ if [ "$CHANGED" != "false" ] && [ "$TEST_RESULT" != "success" ]; then ++ exit 1 ++ fi diff --git a/upstream/sources.json b/upstream/sources.json index 8c393ce..81fb92a 100644 --- a/upstream/sources.json +++ b/upstream/sources.json @@ -63,6 +63,24 @@ "sha256": "e66e5c0b4ff2cf6741a1891849ea3de8662c77c6d198131e0cf54ab2a82cccf7", "destination": "upstream/vendor/nextcloud/lint-stylelint.yml" }, + { + "name": "nextcloud-lint-typescript", + "repository": "nextcloud/.github", + "ref": "master", + "path": "workflow-templates/lint-typescript.yml", + "url": "https://raw.githubusercontent.com/nextcloud/.github/cf6248d5ef28a328cde764daf80bc5fae4705ade/workflow-templates/lint-typescript.yml", + "sha256": "2b243e05ff8ac82561a46aab1d485e4a83cf13c939f74b6f978d43ab197ab951", + "destination": "upstream/vendor/nextcloud/lint-typescript.yml" + }, + { + "name": "nextcloud-node-test", + "repository": "nextcloud/.github", + "ref": "master", + "path": "workflow-templates/node-test.yml", + "url": "https://raw.githubusercontent.com/nextcloud/.github/cf6248d5ef28a328cde764daf80bc5fae4705ade/workflow-templates/node-test.yml", + "sha256": "e6245c256fb6e124678b6d802d2f5133f47ab6d0280b71db1d613d1921343605", + "destination": "upstream/vendor/nextcloud/node-test.yml" + }, { "name": "nextcloud-npm-build", "repository": "nextcloud/.github", diff --git a/upstream/templates.json b/upstream/templates.json index 2deccf4..19beed2 100644 --- a/upstream/templates.json +++ b/upstream/templates.json @@ -56,6 +56,22 @@ ], "destination": ".github/workflows/lint-stylelint.yml" }, + { + "name": "nextcloud-lint-typescript", + "source": "upstream/vendor/nextcloud/lint-typescript.yml", + "patches": [ + "patches/nextcloud/lint-typescript.yml.patch" + ], + "destination": ".github/workflows/lint-typescript.yml" + }, + { + "name": "nextcloud-node-test", + "source": "upstream/vendor/nextcloud/node-test.yml", + "patches": [ + "patches/nextcloud/node-test.yml.patch" + ], + "destination": ".github/workflows/node-test.yml" + }, { "name": "nextcloud-npm-build", "source": "upstream/vendor/nextcloud/npm-build.yml", diff --git a/upstream/vendor/nextcloud/lint-typescript.yml b/upstream/vendor/nextcloud/lint-typescript.yml new file mode 100644 index 0000000..0b865e6 --- /dev/null +++ b/upstream/vendor/nextcloud/lint-typescript.yml @@ -0,0 +1,100 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Type checking + +on: + pull_request: + push: + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: lint-typescript-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + + outputs: + src: ${{ steps.changes.outputs.src}} + + steps: + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/lint-typescript.yml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '**.ts' + - '**.vue' + + test: + runs-on: ubuntu-latest + + needs: changes + if: needs.changes.outputs.src != 'false' + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 + id: versions + with: + fallbackNode: '^24' + fallbackNpm: '^11.3' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} + run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' + + - name: Install dependencies + env: + CYPRESS_INSTALL_BINARY: 0 + run: | + npm ci + + - name: Check types + run: | + npm run --if-present check-types + npm run --if-present ts:check + + summary: + permissions: + contents: none + runs-on: ubuntu-latest-low + needs: [changes, test] + + if: always() + + name: typescript-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi diff --git a/upstream/vendor/nextcloud/node-test.yml b/upstream/vendor/nextcloud/node-test.yml new file mode 100644 index 0000000..1b74d3e --- /dev/null +++ b/upstream/vendor/nextcloud/node-test.yml @@ -0,0 +1,112 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Node tests + +on: + pull_request: + push: + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: node-tests-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + + outputs: + src: ${{ steps.changes.outputs.src}} + + steps: + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - '__tests__/**' + - '__mocks__/**' + - 'src/**' + - 'appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '**.js' + - '**.ts' + - '**.vue' + + test: + runs-on: ubuntu-latest + + needs: changes + if: needs.changes.outputs.src != 'false' + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 + id: versions + with: + fallbackNode: '^24' + fallbackNpm: '^11.3' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} + run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' + + - name: Install dependencies & build + env: + CYPRESS_INSTALL_BINARY: 0 + run: | + npm ci + npm run build --if-present + + - name: Test + run: npm run test --if-present + + - name: Test and process coverage + run: npm run test:coverage --if-present + + - name: Collect coverage + uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + with: + files: ./coverage/lcov.info + + summary: + permissions: + contents: none + runs-on: ubuntu-latest-low + needs: [changes, test] + + if: always() + + name: test-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi