Skip to content

Commit

Permalink
Remove CI Debugger (#824)
Browse files Browse the repository at this point in the history
CI Debugger has been deprecated, so remove its steps and standardize
across platforms.

Also start uploading flaky test info for macOS to prod and staging
  • Loading branch information
TylerJang27 authored Jul 12, 2024
1 parent 7df5bb3 commit 82ed959
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 83 deletions.
38 changes: 18 additions & 20 deletions .github/actions/action_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ inputs:
description: Additional args to append to the test invocation
required: false
default: actions/ --
trunk-token:
description: CI debugger api token
required: true
trunk-staging-token:
description: Test analytics staging api token (org token)
required: false
trunk-prod-token:
description: Test analytics prod api token (org token)
required: false

runs:
# TODO(Tyler): See if this can be converted to a js action
Expand Down Expand Up @@ -49,7 +52,6 @@ runs:
working-directory: ${{ inputs.path }}

- name: Run action tests
if: runner.os == 'Windows'
run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --passWithNoTests --ci
shell: bash
working-directory: ${{ inputs.path }}
Expand All @@ -58,25 +60,21 @@ runs:
PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }}
PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }}

- name: Run action tests
if: runner.os != 'Windows'
uses: trunk-io/[email protected]
- name: Upload prod results
# TODO(Tyler): Add upload on Windows once the action supports it.
if: "!cancelled() && runner.os != 'Windows' && inputs.trunk-prod-token != ''"
uses: trunk-io/analytics-uploader@main
with:
breakpoint-id: trunk-plugins-action-tests
shell: bash
working-directory: ${{ inputs.path }}
trunk-token: ${{ inputs.trunk-token }}
org: trunk-staging-org
run:
npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --passWithNoTests --ci
junit-paths: junit.xml
org-slug: trunk
token: ${{ inputs.trunk-prod-token }}
continue-on-error: true
env:
JEST_SUITE_NAME: Action Tests
PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }}
PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }}
TRUNK_PUBLIC_API_ADDRESS: https://api.trunk.io

- name: Upload results
# TODO(Tyler): Add upload on MacOS/Windows once the action supports it.
if: "!cancelled() && runner.os == 'Linux'"
- name: Upload staging results
# TODO(Tyler): Add upload on Windows once the action supports it.
if: "!cancelled() && runner.os != 'Windows' && inputs.trunk-staging-token != ''"
uses: trunk-io/analytics-uploader@main
with:
junit-paths: junit.xml
Expand Down
43 changes: 18 additions & 25 deletions .github/actions/linter_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ inputs:
sourcery-token:
description: Token to login for sourcery test
required: true
trunk-token:
description: CI debugger api token (org token)
required: true
trunk-staging-token:
description: Test analytics staging api token (org token)
required: false
trunk-prod-token:
description: Test analytics prod api token (org token)
required: false
ref-type:
description: release or main
required: false
Expand Down Expand Up @@ -92,7 +95,6 @@ runs:
working-directory: ${{ inputs.path }}

- name: Run plugin tests
if: runner.os == 'Windows'
run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --ci
shell: bash
working-directory: ${{ inputs.path }}
Expand All @@ -107,30 +109,21 @@ runs:
JEST_JUNIT_SUITE_NAME:
"{title} ${{ runner.os }} ${{ inputs.ref-type }} ${{ inputs.linter-version }}"

- name: Run plugin tests
if: runner.os != 'Windows'
# trunk-ignore(semgrep/yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha)
uses: trunk-io/[email protected]
- name: Upload prod results
# TODO(Tyler): Add upload on Windows once the action supports it.
if: "!cancelled() && runner.os != 'Windows' && inputs.trunk-prod-token != ''"
uses: trunk-io/analytics-uploader@main
with:
breakpoint-id: trunk-plugins-linter-tests
shell: bash
working-directory: ${{ inputs.path }}
trunk-token: ${{ inputs.trunk-token }}
org: trunk-staging-org
run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --ci --runInBand
junit-paths: junit.xml
org-slug: trunk
token: ${{ inputs.trunk-prod-token }}
continue-on-error: true
env:
PLUGINS_TEST_LINTER_VERSION: ${{ inputs.linter-version }}
PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }}
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 }} ${{ env.JEST_LINTER_VERSION }}"
TRUNK_PUBLIC_API_ADDRESS: https://api.trunk.io

- name: Upload results
# TODO(Tyler): Add upload on MacOS/Windows once the action supports it.
if: "!cancelled() && runner.os == 'Linux'"
- name: Upload staging results
# TODO(Tyler): Add upload on Windows once the action supports it.
if: "!cancelled() && runner.os != 'Windows' && inputs.trunk-staging-token != ''"
uses: trunk-io/analytics-uploader@main
with:
junit-paths: junit.xml
Expand Down
39 changes: 18 additions & 21 deletions .github/actions/tool_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ inputs:
description: Additional args to append to the test invocation
required: false
default: tools --
trunk-token:
description: CI debugger api token (org token)
required: true
trunk-staging-token:
description: Test analytics staging api token (org token)
required: false
trunk-prod-token:
description: Test analytics prod api token (org token)
required: false
ref-type:
description: release or main
required: false
Expand Down Expand Up @@ -65,7 +68,6 @@ runs:
working-directory: ${{ inputs.path }}

- name: Run plugin tests
if: runner.os == 'Windows'
run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --ci
shell: bash
working-directory: ${{ inputs.path }}
Expand All @@ -75,26 +77,21 @@ runs:
JEST_SUITE_NAME: Tool Tests
JEST_JUNIT_SUITE_NAME: "{title} ${{ runner.os }} ${{ inputs.ref-type }}"

- name: Run plugin tests
if: runner.os != 'Windows'
# trunk-ignore(semgrep/yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha)
uses: trunk-io/[email protected]
- name: Upload prod results
# TODO(Tyler): Add upload on Windows once the action supports it.
if: "!cancelled() && runner.os != 'Windows' && inputs.trunk-prod-token != ''"
uses: trunk-io/analytics-uploader@main
with:
breakpoint-id: trunk-plugins-tool-tests
shell: bash
working-directory: ${{ inputs.path }}
trunk-token: ${{ inputs.trunk-token }}
org: trunk-staging-org
run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --ci
junit-paths: junit.xml
org-slug: trunk
token: ${{ inputs.trunk-prod-token }}
continue-on-error: true
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 }}"
TRUNK_PUBLIC_API_ADDRESS: https://api.trunk.io

- name: Upload results
# TODO(Tyler): Add upload on MacOS/Windows once the action supports it.
if: "!cancelled() && runner.os == 'Linux'"
- name: Upload staging results
# TODO(Tyler): Add upload on Windows once the action supports it.
if: "!cancelled() && runner.os != 'Windows' && inputs.trunk-staging-token != ''"
uses: trunk-io/analytics-uploader@main
with:
junit-paths: junit.xml
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ jobs:
linter-version: ${{ matrix.linter-version }}
ref-type: main
sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }}
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

# Run tests against all linters for snapshots and latest version as they exist in latest release
# This job is used to update the list of validated versions
Expand Down Expand Up @@ -176,7 +177,8 @@ jobs:
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 }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

- name: Upload Test Outputs for Upload Job
# Only upload results from latest. Always run, except when cancelled.
Expand All @@ -201,6 +203,7 @@ jobs:
TRUNK_OPEN_PR_APP_PRIVATE_KEY: ${{ secrets.TRUNK_OPEN_PR_APP_PRIVATE_KEY }}
TRUNK_SOURCERY_TOKEN: ${{ secrets.TRUNK_SOURCERY_TOKEN }}
TRUNK_DEBUGGER_TOKEN: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
TRUNK_ORG_PROD_TOKEN: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}
with:
plugin-version: ${{ needs.linter_tests_release.outputs.plugin-version }}
upload-validated-versions: true
Expand Down Expand Up @@ -235,7 +238,8 @@ jobs:
uses: ./.github/actions/tool_tests
with:
append-args: tools -- --json --outputFile=${{ matrix.results-file }}-res.json
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

- name: Upload Test Outputs for Notification Job
# Always run, except when cancelled.
Expand All @@ -255,6 +259,7 @@ jobs:
TRUNKBOT_SLACK_BOT_TOKEN: ${{ secrets.TRUNKBOT_SLACK_BOT_TOKEN }}
TRUNK_SOURCERY_TOKEN: ${{ secrets.TRUNK_SOURCERY_TOKEN }}
TRUNK_DEBUGGER_TOKEN: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
TRUNK_ORG_PROD_TOKEN: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}
with:
plugin-version: main
results-prefix: tools-
Expand All @@ -278,4 +283,5 @@ jobs:
- name: Action Tests
uses: ./.github/actions/action_tests
with:
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}
18 changes: 12 additions & 6 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ jobs:
append-args:
${{ needs.detect_changes.outputs.all-linters }} ${{
needs.detect_changes.outputs.linters-files }}
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

- name: Linter Tests Latest
# Run tests on Latest with any modified linters (see filters.yaml). Don't run when cancelled.
Expand All @@ -168,7 +169,8 @@ jobs:
ref-type: main
sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }}
append-args: ${{ needs.detect_changes.outputs.linters-files }}
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

tool_tests:
name: Tool Tests
Expand All @@ -194,7 +196,8 @@ jobs:
append-args:
${{ needs.detect_changes.outputs.all-tools }} ${{
needs.detect_changes.outputs.tools-files }}
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

action_tests:
name: Action Tests
Expand All @@ -214,7 +217,8 @@ jobs:
append-args:
${{ needs.detect_changes.outputs.all-actions }} ${{
needs.detect_changes.outputs.actions-files }} --
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

trunk_check_runner:
name: Trunk Check runner [linux]
Expand Down Expand Up @@ -261,7 +265,8 @@ jobs:
sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }}
cli-path: ${{ github.workspace }}\trunk.ps1
append-args: ${{needs.detect_changes.outputs.linters-files }} -- --maxWorkers=5
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

windows_tool_tests:
name: Windows Tool Tests
Expand All @@ -285,7 +290,8 @@ jobs:
with:
append-args: ${{needs.detect_changes.outputs.tools-files }} -- --maxWorkers=5
cli-path: ${{ github.workspace }}\trunk.ps1
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

# Run repo healthcheck tests
repo_tests:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/upload_results.reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ on:
required: false
TRUNK_DEBUGGER_TOKEN:
required: false
TRUNK_ORG_PROD_TOKEN:
required: false

permissions:
actions: write
Expand Down Expand Up @@ -258,7 +260,8 @@ jobs:
ref-type: main
append-args: ${{ needs.upload_test_results.outputs.reruns }} -- -u
sourcery-token: ${{ secrets.TRUNK_SOURCERY_TOKEN }}
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}
env:
PLUGINS_TEST_UPDATE_SNAPSHOTS: "true"

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/windows_nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ jobs:
cli-path: ${{ github.workspace }}\trunk.ps1
# manually specify more parallelism to avoid bottlenecks
append-args: linters -- --maxWorkers=5
# CI Debugger is not yet supported on Windows
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
# Analytics uploader is not yet supported on Windows
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}

tool_tests_main:
name: Tool Tests Main
Expand Down Expand Up @@ -88,5 +89,6 @@ jobs:
with:
cli-path: ${{ github.workspace }}\trunk.ps1
append-args: tools -- --maxWorkers=5
# CI Debugger is not yet supported on Windows
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
# Analytics uploader is not yet supported on Windows
trunk-staging-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
trunk-prod-token: ${{ secrets.TRUNK_ORG_PROD_TOKEN }}
4 changes: 2 additions & 2 deletions tests/driver/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const UNINITIALIZED_ERROR = `You have attempted to modify the sandbox before it
Please call this method after setup has been called.`;

export const executionEnv = (sandbox: string) => {
// trunk-ignore(eslint/@typescript-eslint/no-unused-vars): Strip TRUNK_CLI_VERSION from CI-Debugger
const { PWD, INIT_CWD, TRUNK_CLI_VERSION, ...strippedEnv } = process.env;
// trunk-ignore(eslint/@typescript-eslint/no-unused-vars): Remove vars.
const { PWD, INIT_CWD, ...strippedEnv } = process.env;
return {
...strippedEnv,
// This keeps test downloads separate from manual trunk invocations
Expand Down

0 comments on commit 82ed959

Please sign in to comment.