From 54cc37e0d1ed9dedced0d8feb124896cdedb894b Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 7 Nov 2025 10:25:17 +0000 Subject: [PATCH 1/7] Cache dependencies in CI workflow --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 864e24d53..1ac9f98de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,30 @@ env: GOPROXY: "direct" jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Configure Go Proxy + uses: ./.github/actions/configure-goproxy + with: + user: ${{ secrets.ARTIFACTORY_USER }} + token: ${{ secrets.ARTIFACTORY_TOKEN }} + url: ${{ secrets.ARTIFACTORY_URL_DEV }} + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 + with: + go-version-file: 'go.mod' + - name: Build + run: make build + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + proxy-sanity-check: name: Proxy Sanity Check runs-on: ubuntu-22.04 @@ -36,7 +60,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: run goproxy-sanity-check run: | make build @@ -44,6 +67,7 @@ jobs: lint: name: Lint runs-on: ubuntu-22.04 + depends-on: build steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Configure Go Proxy @@ -55,7 +79,12 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Lint Go uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: @@ -77,7 +106,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Run Unit Tests run: make unit-test - name: Uplaod Test Coverage @@ -100,7 +128,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Run unit tests with race condition detection run: make race-condition-test @@ -120,7 +147,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Setup Build Environment run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }} - name: Build Packages @@ -157,7 +183,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -207,7 +232,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -264,7 +288,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -331,7 +354,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -397,7 +419,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Download Packages uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 with: @@ -464,7 +485,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Download Packages uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 with: @@ -515,7 +535,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Run Performance Tests run: | make performance-test @@ -547,7 +566,6 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' - cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 From d97d432ecf98542f89cb64886791f9279e23fe07 Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 7 Nov 2025 10:35:14 +0000 Subject: [PATCH 2/7] Cache dependencies in CI workflow --- .github/workflows/ci.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ac9f98de..e8e3452bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,27 +47,10 @@ jobs: restore-keys: | ${{ runner.os }}-go- - proxy-sanity-check: - name: Proxy Sanity Check - runs-on: ubuntu-22.04 - if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }} - env: - GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_URL_DEV }}" - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - fetch-tags: 'true' - - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 - with: - go-version-file: 'go.mod' - - name: run goproxy-sanity-check - run: | - make build - lint: name: Lint runs-on: ubuntu-22.04 - depends-on: build + needs: build steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Configure Go Proxy From 4df1e683999af1caafb3dbda168805e2b97f8a71 Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 7 Nov 2025 10:43:12 +0000 Subject: [PATCH 3/7] Cache dependencies in CI workflow --- .github/workflows/ci.yml | 173 +++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 90 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8e3452bd..2a38882d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,34 +23,46 @@ env: GOPROXY: "direct" jobs: - build: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - name: Configure Go Proxy - uses: ./.github/actions/configure-goproxy - with: - user: ${{ secrets.ARTIFACTORY_USER }} - token: ${{ secrets.ARTIFACTORY_TOKEN }} - url: ${{ secrets.ARTIFACTORY_URL_DEV }} - - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 - with: - go-version-file: 'go.mod' - - name: Build - run: make build - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + build-unsigned-snapshot: + name: Build Unsigned Snapshot + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-tags: 'true' + - name: Configure Go Proxy + uses: ./.github/actions/configure-goproxy + with: + user: ${{ secrets.ARTIFACTORY_USER }} + token: ${{ secrets.ARTIFACTORY_TOKEN }} + url: ${{ secrets.ARTIFACTORY_URL_DEV }} + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 + with: + go-version-file: 'go.mod' + - name: Setup Build Environment + run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }} + - name: Build Packages + run: | + make clean local-deb-package local-rpm-package local-apk-package + - name: Upload Artifacts + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: nginx-agent-unsigned-snapshots + path: build + retention-days: 1 + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- lint: name: Lint runs-on: ubuntu-22.04 - needs: build + needs: build-unsigned-snapshot steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Configure Go Proxy @@ -74,73 +86,53 @@ jobs: version: v2.4.0 unit-test: - name: Unit Tests - runs-on: ubuntu-22.04 - permissions: - contents: write - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - name: Configure Go Proxy - uses: ./.github/actions/configure-goproxy - with: - user: ${{ secrets.ARTIFACTORY_USER }} - token: ${{ secrets.ARTIFACTORY_TOKEN }} - url: ${{ secrets.ARTIFACTORY_URL_DEV }} - - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 - with: - go-version-file: 'go.mod' - - name: Run Unit Tests - run: make unit-test - - name: Uplaod Test Coverage - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 - with: - files: ./build/test/coverage.out - token: ${{ secrets.CODECOV_TOKEN }} + name: Unit Tests + runs-on: ubuntu-22.04 + needs: build-unsigned-snapshot + permissions: + contents: write + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Configure Go Proxy + uses: ./.github/actions/configure-goproxy + with: + user: ${{ secrets.ARTIFACTORY_USER }} + token: ${{ secrets.ARTIFACTORY_TOKEN }} + url: ${{ secrets.ARTIFACTORY_URL_DEV }} + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 + with: + go-version-file: 'go.mod' + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- + - name: Run Unit Tests + run: make unit-test + - name: Uplaod Test Coverage + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + with: + files: ./build/test/coverage.out + token: ${{ secrets.CODECOV_TOKEN }} race-condition-test: - name: Unit tests with race condition detection - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - name: Configure Go Proxy - uses: ./.github/actions/configure-goproxy - with: - user: ${{ secrets.ARTIFACTORY_USER }} - token: ${{ secrets.ARTIFACTORY_TOKEN }} - url: ${{ secrets.ARTIFACTORY_URL_DEV }} - - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 - with: - go-version-file: 'go.mod' - - name: Run unit tests with race condition detection - run: make race-condition-test - - build-unsigned-snapshot: - name: Build Unsigned Snapshot - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - fetch-tags: 'true' - - name: Configure Go Proxy - uses: ./.github/actions/configure-goproxy - with: - user: ${{ secrets.ARTIFACTORY_USER }} - token: ${{ secrets.ARTIFACTORY_TOKEN }} - url: ${{ secrets.ARTIFACTORY_URL_DEV }} - - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 - with: - go-version-file: 'go.mod' - - name: Setup Build Environment - run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }} - - name: Build Packages - run: | - make clean local-deb-package local-rpm-package local-apk-package - - name: Upload Artifacts - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: nginx-agent-unsigned-snapshots - path: build - retention-days: 1 + name: Unit tests with race condition detection + runs-on: ubuntu-22.04 + needs: build-unsigned-snapshot + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Configure Go Proxy + uses: ./.github/actions/configure-goproxy + with: + user: ${{ secrets.ARTIFACTORY_USER }} + token: ${{ secrets.ARTIFACTORY_TOKEN }} + url: ${{ secrets.ARTIFACTORY_URL_DEV }} + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 + with: + go-version-file: 'go.mod' + - name: Run unit tests with race condition detection + run: make race-condition-test integration-tests: name: Integration Tests @@ -505,6 +497,7 @@ jobs: performance-tests: name: Performance Tests runs-on: ubuntu-22.04 + needs: build-unsigned-snapshot permissions: contents: write steps: @@ -536,6 +529,7 @@ jobs: - name: Push benchmark result if: ${{ success() && github.ref_name == 'main'}} run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results + load-tests: name: Load Tests if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }} @@ -543,7 +537,6 @@ jobs: contents: write runs-on: ubuntu-22.04 needs: build-unsigned-snapshot - steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 From 679125ff8bcbd9717805042afda1e8247fbd20ea Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 7 Nov 2025 10:56:02 +0000 Subject: [PATCH 4/7] Cache dependencies in CI workflow --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a38882d7..462fe4c85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,18 @@ jobs: url: ${{ secrets.ARTIFACTORY_URL_DEV }} - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: - go-version-file: 'go.mod' + go-version-file: 'go.mod' + cache: false + - name: Download Go modules + run: go mod download + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Setup Build Environment run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }} - name: Build Packages @@ -50,14 +61,6 @@ jobs: name: nginx-agent-unsigned-snapshots path: build retention-days: 1 - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- lint: name: Lint @@ -73,7 +76,8 @@ jobs: url: ${{ secrets.ARTIFACTORY_URL_DEV }} - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: - go-version-file: 'go.mod' + go-version-file: 'go.mod' + cache: false - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | @@ -101,7 +105,8 @@ jobs: url: ${{ secrets.ARTIFACTORY_URL_DEV }} - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: - go-version-file: 'go.mod' + go-version-file: 'go.mod' + cache: false - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | @@ -130,7 +135,8 @@ jobs: url: ${{ secrets.ARTIFACTORY_URL_DEV }} - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: - go-version-file: 'go.mod' + go-version-file: 'go.mod' + cache: false - name: Run unit tests with race condition detection run: make race-condition-test @@ -158,6 +164,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -207,6 +214,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -263,6 +271,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -329,6 +338,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -394,6 +404,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Download Packages uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 with: @@ -460,6 +471,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Download Packages uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 with: @@ -511,6 +523,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Run Performance Tests run: | make performance-test @@ -542,6 +555,7 @@ jobs: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: 'go.mod' + cache: false - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 From fb8aa68588a28c460f329cd3313e2e7d192c4ff1 Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 7 Nov 2025 11:45:33 +0000 Subject: [PATCH 5/7] Cache dependencies in CI workflow --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 462fe4c85..d1c279f79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,6 +137,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Run unit tests with race condition detection run: make race-condition-test @@ -165,6 +171,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -215,6 +227,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -272,6 +290,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -339,6 +363,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: @@ -405,6 +435,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Download Packages uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 with: @@ -472,6 +508,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Download Packages uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 with: @@ -524,6 +566,12 @@ jobs: with: go-version-file: 'go.mod' cache: false + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Run Performance Tests run: | make performance-test @@ -556,6 +604,13 @@ jobs: with: go-version-file: 'go.mod' cache: false + + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- - name: Download Packages uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 From ea19a90eed6e0705cd77b7c0ec5d07445bcd834d Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 7 Nov 2025 12:05:21 +0000 Subject: [PATCH 6/7] Cache dependencies in CI workflow --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1c279f79..e7034661f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,8 @@ jobs: cache: false - name: Download Go modules run: go mod download + - name: Fix permissions + run: chmod -R 0755 ~/go/pkg/mod ~/.cache/go-build - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | @@ -604,7 +606,7 @@ jobs: with: go-version-file: 'go.mod' cache: false - + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | From c7761fc900a89004649dcf2ce818bd0f70c06663 Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 7 Nov 2025 13:31:20 +0000 Subject: [PATCH 7/7] Cache dependencies in CI workflow --- .github/workflows/ci.yml | 114 ++++++++++++++++++++++++--------------- go.mod | 4 +- go.sum | 8 +-- 3 files changed, 77 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7034661f..9ceed3942 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,51 +23,42 @@ env: GOPROXY: "direct" jobs: - build-unsigned-snapshot: - name: Build Unsigned Snapshot - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - fetch-tags: 'true' - - name: Configure Go Proxy - uses: ./.github/actions/configure-goproxy - with: - user: ${{ secrets.ARTIFACTORY_USER }} - token: ${{ secrets.ARTIFACTORY_TOKEN }} - url: ${{ secrets.ARTIFACTORY_URL_DEV }} - - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 - with: - go-version-file: 'go.mod' - cache: false - - name: Download Go modules - run: go mod download - - name: Fix permissions - run: chmod -R 0755 ~/go/pkg/mod ~/.cache/go-build - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Setup Build Environment - run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }} - - name: Build Packages - run: | - make clean local-deb-package local-rpm-package local-apk-package - - name: Upload Artifacts - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: nginx-agent-unsigned-snapshots - path: build - retention-days: 1 + cache-dependencies: + name: Cache Dependencies + runs-on: ubuntu-22.04 + if: github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-tags: 'true' + - name: Configure Go Proxy + uses: ./.github/actions/configure-goproxy + with: + user: ${{ secrets.ARTIFACTORY_USER }} + token: ${{ secrets.ARTIFACTORY_TOKEN }} + url: ${{ secrets.ARTIFACTORY_URL_DEV }} + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 + with: + go-version-file: 'go.mod' + cache: false + - name: Download Go modules + run: go mod download + - name: Setup Build Environment + run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }} + - name: Fix golang dependency permissions + run: chmod -R 0755 ~/go/pkg/mod ~/.cache/go-build + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- lint: name: Lint runs-on: ubuntu-22.04 - needs: build-unsigned-snapshot steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Configure Go Proxy @@ -94,7 +85,6 @@ jobs: unit-test: name: Unit Tests runs-on: ubuntu-22.04 - needs: build-unsigned-snapshot permissions: contents: write steps: @@ -126,7 +116,6 @@ jobs: race-condition-test: name: Unit tests with race condition detection runs-on: ubuntu-22.04 - needs: build-unsigned-snapshot steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Configure Go Proxy @@ -148,6 +137,45 @@ jobs: - name: Run unit tests with race condition detection run: make race-condition-test + build-unsigned-snapshot: + name: Build Unsigned Snapshot + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-tags: 'true' + - name: Configure Go Proxy + uses: ./.github/actions/configure-goproxy + with: + user: ${{ secrets.ARTIFACTORY_USER }} + token: ${{ secrets.ARTIFACTORY_TOKEN }} + url: ${{ secrets.ARTIFACTORY_URL_DEV }} + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 + with: + go-version-file: 'go.mod' + cache: false + - name: Download Go modules + run: go mod download + - name: Setup Build Environment + run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }} + - name: Fix golang dependency permissions + run: chmod -R 0755 ~/go/pkg/mod ~/.cache/go-build + - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go- + - name: Build Packages + run: | + make clean local-deb-package local-rpm-package local-apk-package + - name: Upload Artifacts + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: nginx-agent-unsigned-snapshots + path: build + retention-days: 1 + integration-tests: name: Integration Tests needs: build-unsigned-snapshot diff --git a/go.mod b/go.mod index 39ad720a8..1c324f9cb 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.9-20250912141014-52f32327d4b0.1 buf.build/go/protovalidate v1.0.0 github.com/cenkalti/backoff/v4 v4.3.0 - github.com/docker/docker v28.4.0+incompatible + github.com/docker/docker v28.5.1+incompatible github.com/fsnotify/fsnotify v1.9.0 github.com/go-resty/resty/v2 v2.16.5 github.com/goccy/go-yaml v1.18.0 @@ -42,7 +42,7 @@ require ( github.com/shirou/gopsutil/v4 v4.25.9 github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.11.1 - github.com/testcontainers/testcontainers-go v0.39.0 + github.com/testcontainers/testcontainers-go v0.40.0 github.com/trivago/grok v1.0.0 go.opentelemetry.io/collector/component v1.45.0 go.opentelemetry.io/collector/component/componenttest v0.139.0 diff --git a/go.sum b/go.sum index 0ecee6728..c69b1a1b6 100644 --- a/go.sum +++ b/go.sum @@ -164,8 +164,8 @@ github.com/digitalocean/godo v1.165.1 h1:H37+W7TaGFOVH+HpMW4ZeW/hrq3AGNxg+B/K8/d github.com/digitalocean/godo v1.165.1/go.mod h1:xQsWpVCCbkDrWisHA72hPzPlnC+4W5w/McZY5ij9uvU= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v28.4.0+incompatible h1:KVC7bz5zJY/4AZe/78BIvCnPsLaC9T/zh72xnlrTTOk= -github.com/docker/docker v28.4.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v28.5.1+incompatible h1:Bm8DchhSD2J6PsFzxC35TZo4TLGR2PdW/E69rU45NhM= +github.com/docker/docker v28.5.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94= github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -711,8 +711,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/testcontainers/testcontainers-go v0.39.0 h1:uCUJ5tA+fcxbFAB0uP3pIK3EJ2IjjDUHFSZ1H1UxAts= -github.com/testcontainers/testcontainers-go v0.39.0/go.mod h1:qmHpkG7H5uPf/EvOORKvS6EuDkBUPE3zpVGaH9NL7f8= +github.com/testcontainers/testcontainers-go v0.40.0 h1:pSdJYLOVgLE8YdUY2FHQ1Fxu+aMnb6JfVz1mxk7OeMU= +github.com/testcontainers/testcontainers-go v0.40.0/go.mod h1:FSXV5KQtX2HAMlm7U3APNyLkkap35zNLxukw9oBi/MY= github.com/tilinna/clock v1.1.0 h1:6IQQQCo6KoBxVudv6gwtY8o4eDfhHo8ojA5dP0MfhSs= github.com/tilinna/clock v1.1.0/go.mod h1:ZsP7BcY7sEEz7ktc0IVy8Us6boDrK8VradlKRUGfOao= github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=