From e3b2b101dfd3c8e46ff00aac48ce68edf556b5d9 Mon Sep 17 00:00:00 2001 From: Uday Date: Mon, 11 May 2026 12:47:11 +0530 Subject: [PATCH 1/4] Upgrade the smart-tests-cli to v2 and add the caller env variable for tracking purpose --- .github/workflows/go-test-example.yaml | 22 +++++-------- action.yaml | 43 ++++++++++++++------------ 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/.github/workflows/go-test-example.yaml b/.github/workflows/go-test-example.yaml index 9c43c35..0044e10 100644 --- a/.github/workflows/go-test-example.yaml +++ b/.github/workflows/go-test-example.yaml @@ -7,33 +7,25 @@ on: branches: [main] env: - LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN }} + SMART_TESTS_TOKEN: ${{ secrets.SMART_TESTS_TOKEN }} jobs: tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: 1.18 + go-version: "1.21" - name: Clone go-test example run: git clone https://github.com/launchableinc/examples.git - name: Install dependencies - run: go install github.com/jstemmer/go-junit-report@latest + run: go install github.com/jstemmer/go-junit-report/v2@latest - name: Record build action uses: ./ - # uses: launchableinc/record-build-action@v1.0.0 with: build_name: $GITHUB_RUN_ID source_path: ./examples/go/ - - name: test - run: cd examples/go && go test -v ./... 2>&1 | go-junit-report -set-exit-code > report.xml - - name: Record test results to build action - uses: launchableinc/record-test-results-to-build-action@v1.0.0 - with: - build_name: $GITHUB_RUN_ID - report_path: ./examples/go/ - test_runner: go-test - if: always() \ No newline at end of file diff --git a/action.yaml b/action.yaml index 9741235..4f17868 100644 --- a/action.yaml +++ b/action.yaml @@ -1,6 +1,6 @@ name: "Record build action" -author: "launchableinc" -description: "Launchable action for recording a build" +author: "CloudBees" +description: "Smart Tests action for recording a build" branding: icon: 'circle' color: 'gray-dark' @@ -18,8 +18,8 @@ inputs: default: "false" python_version: required: false - description: "Python version >= 3.5 <=3.10. Default 3.10" - default: "3.10" + description: "Python version >= 3.13. Default 3.13" + default: "3.13" source_path: required: false description: "Path to a local Git repository/workspace. Default current directory." @@ -28,32 +28,35 @@ runs: using: "composite" steps: - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v6 with: python-version: ${{ inputs.python_version }} - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v5 with: - java-version: 1.8 + distribution: 'temurin' + java-version: 8 + - id: set_caller + shell: bash + run: echo "SMART_TESTS_CALLER=record-build-action" >> $GITHUB_ENV - id: install shell: bash - run: pip install launchable + run: pip install smart-tests-cli - id: verify shell: bash run: | - launchable verify + smart-tests verify - id: record_build shell: bash run: | - if [ "${{ inputs.no_submodules }}" == "false" ]; then - launchable record build \ - --name ${{ inputs.build_name }} \ - --max-days ${{ inputs.max_days }} \ - --source src=${{ inputs.source_path }} - else - launchable record build \ - --name ${{ inputs.build_name }} \ - --max-days ${{ inputs.max_days }} \ - --source src=${{ inputs.source_path }} \ - --no-submodules + options=( + "--build" "${{ inputs.build_name }}" + "--max-days" "${{ inputs.max_days }}" + "--source" "src=${{ inputs.source_path }}" + ) + + if [ "${{ inputs.no_submodules }}" == "true" ]; then + options+=("--no-submodules") fi + + smart-tests record build "${options[@]}" From 7febf168c2b8b88db75574c80134656b12e66032 Mon Sep 17 00:00:00 2001 From: Uday Date: Mon, 11 May 2026 12:56:41 +0530 Subject: [PATCH 2/4] Fix the token name --- .github/workflows/go-test-example.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go-test-example.yaml b/.github/workflows/go-test-example.yaml index 0044e10..8607689 100644 --- a/.github/workflows/go-test-example.yaml +++ b/.github/workflows/go-test-example.yaml @@ -7,7 +7,7 @@ on: branches: [main] env: - SMART_TESTS_TOKEN: ${{ secrets.SMART_TESTS_TOKEN }} + SMART_TESTS_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN }} jobs: tests: From 4ade0f2a3ff39214df7761e8fe7855925ae16032 Mon Sep 17 00:00:00 2001 From: Uday Date: Mon, 11 May 2026 15:34:29 +0530 Subject: [PATCH 3/4] Use UV instead of pip --- action.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/action.yaml b/action.yaml index 4f17868..ee69dcc 100644 --- a/action.yaml +++ b/action.yaml @@ -27,21 +27,19 @@ inputs: runs: using: "composite" steps: - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: ${{ inputs.python_version }} - name: Set up JDK 1.8 uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: 8 + - name: Install uv + uses: astral-sh/setup-uv@v5 - id: set_caller shell: bash run: echo "SMART_TESTS_CALLER=record-build-action" >> $GITHUB_ENV - id: install shell: bash - run: pip install smart-tests-cli + run: uv tool install smart-tests-cli --python ${{ inputs.python_version }} - id: verify shell: bash run: | From 88ce8b5aa7d848b92bd405b3a043ac067c515dcf Mon Sep 17 00:00:00 2001 From: Uday Date: Mon, 11 May 2026 15:35:30 +0530 Subject: [PATCH 4/4] Add the go example test back and use the cloudbees/record-test-results-to-build-action instead --- .github/workflows/go-test-example.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/go-test-example.yaml b/.github/workflows/go-test-example.yaml index 8607689..410a6da 100644 --- a/.github/workflows/go-test-example.yaml +++ b/.github/workflows/go-test-example.yaml @@ -29,3 +29,13 @@ jobs: with: build_name: $GITHUB_RUN_ID source_path: ./examples/go/ + - name: test + run: cd examples/go && go test -v ./... 2>&1 | go-junit-report -set-exit-code > report.xml + - name: Record test results + uses: cloudbees-oss/record-test-results-to-build-action@main + with: + build_name: $GITHUB_RUN_ID + report_path: ./examples/go/ + test_runner: go-test + test_suite: go-test-example + if: always()