diff --git a/.github/actions/action_tests/action.yaml b/.github/actions/action_tests/action.yaml index 16b5a7251..2da8737b8 100644 --- a/.github/actions/action_tests/action.yaml +++ b/.github/actions/action_tests/action.yaml @@ -54,6 +54,7 @@ runs: shell: bash working-directory: ${{ inputs.path }} env: + JEST_SUITE_NAME: Action Tests PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }} PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }} @@ -64,10 +65,23 @@ runs: breakpoint-id: trunk-plugins-action-tests shell: bash working-directory: ${{ inputs.path }} - trunk-token: ${{ inputs.trunk-token }} + trunk-token: ${{ inputs.trunk-token }} org: trunk-staging-org run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --passWithNoTests --ci env: + JEST_SUITE_NAME: Action Tests PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }} PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }} + + - name: Upload results + # TODO(Tyler): Add upload on MacOS/Windows once the action supports it. + if: "!cancelled() && runner.os == 'Linux'" + uses: trunk-io/analytics-uploader@main + with: + junit-paths: junit.xml + org-slug: trunk-staging-org + token: ${{ inputs.trunk-token }} + continue-on-error: true + env: + TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io diff --git a/.github/actions/linter_tests/action.yaml b/.github/actions/linter_tests/action.yaml index 6ce930423..4ab985cee 100644 --- a/.github/actions/linter_tests/action.yaml +++ b/.github/actions/linter_tests/action.yaml @@ -24,8 +24,12 @@ inputs: description: Token to login for sourcery test required: true trunk-token: - description: CI debugger api token + description: CI debugger api token (org token) required: true + ref-type: + description: release or main + required: false + default: main runs: # TODO(Tyler): See if this can be converted to a js action @@ -91,7 +95,10 @@ runs: PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }} SOURCERY_TOKEN: ${{ inputs.sourcery-token }} # Debug recurrent eslint circular JSON errors - DEBUG: Driver:eslint:*,Driver:cspell:*,Driver:nixpkgs-fmt:* + DEBUG: Driver:eslint:*,Driver:nixpkgs-fmt:* + JEST_SUITE_NAME: Linter Tests + JEST_JUNIT_SUITE_NAME: + "{title} ${{ runner.os }} ${{ inputs.ref-type }} ${{ inputs.linter-version }}" - name: Run plugin tests if: runner.os != 'Windows' @@ -101,7 +108,7 @@ runs: breakpoint-id: trunk-plugins-linter-tests shell: bash working-directory: ${{ inputs.path }} - trunk-token: ${{ inputs.trunk-token }} + trunk-token: ${{ inputs.trunk-token }} org: trunk-staging-org run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --ci --runInBand env: @@ -110,3 +117,18 @@ runs: PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }} SOURCERY_TOKEN: ${{ inputs.sourcery-token }} DEBUG: Driver:nixpkgs-fmt:*, Driver:eslint:* + JEST_SUITE_NAME: Linter Tests + JEST_JUNIT_SUITE_NAME: + "{title} ${{ runner.os }} ${{ inputs.ref-type }} ${{ inputs.linter-version }}" + + - name: Upload results + # TODO(Tyler): Add upload on MacOS/Windows once the action supports it. + if: "!cancelled() && runner.os == 'Linux'" + uses: trunk-io/analytics-uploader@main + with: + junit-paths: junit.xml + org-slug: trunk-staging-org + token: ${{ inputs.trunk-token }} + continue-on-error: true + env: + TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io diff --git a/.github/actions/tool_tests/action.yaml b/.github/actions/tool_tests/action.yaml index 1aabf985f..87c296869 100644 --- a/.github/actions/tool_tests/action.yaml +++ b/.github/actions/tool_tests/action.yaml @@ -17,8 +17,12 @@ inputs: required: false default: tools -- trunk-token: - description: CI debugger api token + description: CI debugger api token (org token) required: true + ref-type: + description: release or main + required: false + default: main runs: # TODO(Tyler): See if this can be converted to a js action @@ -56,6 +60,8 @@ runs: env: PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }} PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }} + JEST_SUITE_NAME: Tool Tests + JEST_JUNIT_SUITE_NAME: "{title} ${{ runner.os }} ${{ inputs.ref-type }}" - name: Run plugin tests if: runner.os != 'Windows' @@ -71,3 +77,17 @@ runs: env: PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }} PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }} + JEST_SUITE_NAME: Tool Tests + JEST_JUNIT_SUITE_NAME: "{title} ${{ runner.os }} ${{ inputs.ref-type }}" + + - name: Upload results + # TODO(Tyler): Add upload on MacOS/Windows once the action supports it. + if: "!cancelled() && runner.os == 'Linux'" + uses: trunk-io/analytics-uploader@main + with: + junit-paths: junit.xml + org-slug: trunk-staging-org + token: ${{ inputs.trunk-token }} + continue-on-error: true + env: + TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 20ce4bf2c..91be87085 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -66,6 +66,7 @@ jobs: uses: ./.github/actions/linter_tests with: linter-version: ${{ matrix.linter-version }} + ref-type: main sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }} trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} @@ -173,6 +174,7 @@ jobs: with: linter-version: ${{ matrix.linter-version }} append-args: linters -- --json --outputFile=${{ matrix.results-file }}-res.json + ref-type: release sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }} trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index d1a661a45..a79bfa89a 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -150,6 +150,7 @@ jobs: uses: ./.github/actions/linter_tests with: linter-version: KnownGoodVersion + ref-type: main sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }} append-args: ${{ needs.detect_changes.outputs.all-linters }} ${{ @@ -164,6 +165,7 @@ jobs: uses: ./.github/actions/linter_tests with: linter-version: Latest + ref-type: main sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }} append-args: ${{ needs.detect_changes.outputs.linters-files }} trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} @@ -255,6 +257,7 @@ jobs: uses: ./.github/actions/linter_tests with: linter-version: Latest + ref-type: main sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }} cli-path: ${{ github.workspace }}\trunk.ps1 append-args: ${{needs.detect_changes.outputs.linters-files }} -- --maxWorkers=5 diff --git a/.github/workflows/repo_tests.reusable.yaml b/.github/workflows/repo_tests.reusable.yaml index 1b0814136..379bf28a5 100644 --- a/.github/workflows/repo_tests.reusable.yaml +++ b/.github/workflows/repo_tests.reusable.yaml @@ -38,5 +38,17 @@ jobs: - name: Run repo tests run: npm test tests/repo_tests --ci env: + JEST_SUITE_NAME: Repo Tests PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }} PLUGINS_TEST_CLI_PATH: ${{ inputs.cli-path }} + + - name: Upload results + if: "!cancelled()" + uses: trunk-io/analytics-uploader@main + with: + junit-paths: junit.xml + org-slug: trunk-staging-org + token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} + continue-on-error: true + env: + TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io diff --git a/.github/workflows/upload_results.reusable.yaml b/.github/workflows/upload_results.reusable.yaml index 1882f282a..8229d46bc 100644 --- a/.github/workflows/upload_results.reusable.yaml +++ b/.github/workflows/upload_results.reusable.yaml @@ -255,6 +255,7 @@ jobs: uses: ./.github/actions/linter_tests with: linter-version: Latest + ref-type: main append-args: ${{ needs.upload_test_results.outputs.reruns }} -- -u sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }} trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} diff --git a/.github/workflows/windows_nightly.yaml b/.github/workflows/windows_nightly.yaml index 9c0fa7a7b..6ebf748c9 100644 --- a/.github/workflows/windows_nightly.yaml +++ b/.github/workflows/windows_nightly.yaml @@ -44,6 +44,7 @@ jobs: uses: ./.github/actions/linter_tests with: linter-version: ${{ matrix.linter-version }} + ref-type: main sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }} cli-path: ${{ github.workspace }}\trunk.ps1 # manually specify more parallelism to avoid bottlenecks diff --git a/jest.config.json b/jest.config.json index 6d5d41dac..a6a94bbe4 100644 --- a/jest.config.json +++ b/jest.config.json @@ -2,6 +2,6 @@ "preset": "ts-jest", "modulePaths": [""], "setupFilesAfterEnv": ["/tests/jest_setup.ts"], - "reporters": ["/tests/reporter/index.js", "default"], + "reporters": ["/tests/reporter/index.js", "default", "jest-junit"], "testPathIgnorePatterns": ["/node_modules/", "/repo-tools/"] } diff --git a/package-lock.json b/package-lock.json index 29c235051..d0c90dcd4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "eslint-plugin-simple-import-sort": "^12.1.0", "fast-sort": "^3.2.0", "jest": "^29.3.1", + "jest-junit": "^16.0.0", "jest-specific-snapshot": "^8.0.0", "semver": "^7.6.0", "simple-git": "^3.24.0", @@ -4721,6 +4722,21 @@ "fsevents": "^2.3.2" } }, + "node_modules/jest-junit": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz", + "integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==", + "dev": true, + "dependencies": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + }, + "engines": { + "node": ">=10.12.0" + } + }, "node_modules/jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", @@ -6693,6 +6709,15 @@ "punycode": "^2.1.0" } }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -6814,6 +6839,12 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -10310,6 +10341,18 @@ "walker": "^1.0.8" } }, + "jest-junit": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz", + "integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==", + "dev": true, + "requires": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + } + }, "jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", @@ -11729,6 +11772,12 @@ "punycode": "^2.1.0" } }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true + }, "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -11825,6 +11874,12 @@ "signal-exit": "^3.0.7" } }, + "xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true + }, "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 7fa0ebc84..076d1fbe6 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "eslint-plugin-simple-import-sort": "^12.1.0", "fast-sort": "^3.2.0", "jest": "^29.3.1", + "jest-junit": "^16.0.0", "jest-specific-snapshot": "^8.0.0", "semver": "^7.6.0", "simple-git": "^3.24.0",