From 8c06d3a60af47dfc0a078cc893eeb01dd9b07353 Mon Sep 17 00:00:00 2001 From: Eyal Kapon Date: Tue, 23 Dec 2025 14:37:26 +0200 Subject: [PATCH 1/2] Optimize test workflow by removing unnecessary package manager installations Only Package Handlers tests need all package managers installed since they test the fix functionality. Other test suites (Unit, Scan Repository, Scan Pull Request) don't need npm, Python, pipenv, poetry, Mono, dotnet, NuGet, Pnpm, Java, or Conan installations. This will significantly speed up test execution for non-Package Handler test suites. --- .github/workflows/test.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05602e41e..a9aef2a43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -115,58 +115,66 @@ jobs: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}- ${{ runner.os }}-go- + # Package managers are only needed for Package Handlers tests (fix functionality) - name: Install npm + if: matrix.suite.package == 'packagehandlers' uses: actions/setup-node@v3 with: node-version: "16" - name: Setup Python3 + if: matrix.suite.package == 'packagehandlers' uses: actions/setup-python@v4 with: python-version: "3.x" - name: Install python components + if: matrix.suite.package == 'packagehandlers' run: python -m pip install pipenv poetry - name: Install Mono on macOS + if: matrix.suite.package == 'packagehandlers' && runner.os == 'macOS' run: brew install mono - if: runner.os == 'macOS' - name: Install dotnet + if: matrix.suite.package == 'packagehandlers' uses: actions/setup-dotnet@v4 with: dotnet-version: "6.x" - name: Install Mono on linux - if: runner.os == 'Linux' + if: matrix.suite.package == 'packagehandlers' && runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y mono-devel - name: Install NuGet on Linux + if: matrix.suite.package == 'packagehandlers' && (runner.os == 'Linux' || runner.os == 'macOS') uses: nuget/setup-nuget@v2 with: nuget-version: 6.11.0 - if: runner.os == 'Linux' || runner.os == 'macOS' - uses: awalsh128/cache-apt-pkgs-action@latest - if: runner.os == 'Linux' + if: matrix.suite.package == 'packagehandlers' && runner.os == 'Linux' with: packages: apt-transport-https dirmngr gnupg ca-certificates version: 1.0 - name: Install Pnpm + if: matrix.suite.package == 'packagehandlers' uses: pnpm/action-setup@v3 with: version: 8 - name: Install Java + if: matrix.suite.package == 'packagehandlers' uses: actions/setup-java@v4 with: distribution: "adopt" java-version: "11" - name: Install Conan + if: matrix.suite.package == 'packagehandlers' run: | python -m pip install conan conan profile detect From 0c32df940bae35c1d2345653d3ee0744f7203117 Mon Sep 17 00:00:00 2001 From: Eyal Kapon Date: Tue, 23 Dec 2025 15:17:09 +0200 Subject: [PATCH 2/2] Add Go module caching to integration tests Added Go module cache (~/go/pkg/mod) to all integration test jobs: - github-integration - azure-integration (ubuntu, windows, macos) - gitlab-integration (ubuntu, windows, macos) - bitbucket-server-integration (macos) This matches the caching already used in the main tests and Pretest jobs. Subsequent test runs will restore cached Go modules (~5s) instead of re-downloading them (~30-60s). --- .github/workflows/test.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9aef2a43..bdcb04ae6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -212,6 +212,15 @@ jobs: with: go-version: 1.23.x cache: false + + - name: Go Cache Dependencies + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Go Cache Build & Tests uses: actions/cache@v4 with: @@ -257,6 +266,15 @@ jobs: with: go-version: 1.23.x cache: false + + - name: Go Cache Dependencies + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Go Cache Build & Tests uses: actions/cache@v4 with: @@ -302,6 +320,15 @@ jobs: with: go-version: 1.23.x cache: false + + - name: Go Cache Dependencies + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Go Cache Build & Tests uses: actions/cache@v4 with: @@ -351,6 +378,14 @@ jobs: chmod +x $bb_script_path sh $bb_script_path + - name: Go Cache Dependencies + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Go Cache Build & Tests uses: actions/cache@v4 with: