Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 174 additions & 81 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,38 @@ env:
GOPROXY: "direct"

jobs:
proxy-sanity-check:
name: Proxy Sanity Check
cache-dependencies:
name: Cache Dependencies
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 }}"
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-tags: 'true'
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
- 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: run goproxy-sanity-check
run: |
make build
- 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
Expand All @@ -54,84 +69,112 @@ jobs:
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: 'go.mod'
cache: false
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:
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'
cache: false
- 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
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'
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
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'
cache: false
- name: Run unit tests with race condition detection
run: make 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'
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

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: 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: 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
Expand All @@ -158,6 +201,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:
Expand Down Expand Up @@ -208,6 +257,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:
Expand Down Expand Up @@ -265,6 +320,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:
Expand Down Expand Up @@ -332,6 +393,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:
Expand Down Expand Up @@ -398,6 +465,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:
Expand Down Expand Up @@ -465,6 +538,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:
Expand Down Expand Up @@ -502,6 +581,7 @@ jobs:
performance-tests:
name: Performance Tests
runs-on: ubuntu-22.04
needs: build-unsigned-snapshot
permissions:
contents: write
steps:
Expand All @@ -516,6 +596,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
Expand All @@ -534,21 +620,28 @@ 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-') }}
permissions:
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
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:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading
Loading