Skip to content

Add watcher plugin and instance watcher service (#675) #3040

Add watcher plugin and instance watcher service (#675)

Add watcher plugin and instance watcher service (#675) #3040

Workflow file for this run

name: CI
on:
push:
branches:
- 'v3'
- 'release-*'
paths-ignore:
- "**.md"
- "docs/**"
- "hugo/**"
pull_request:
types:
- opened
- reopened
- synchronize
env:
NFPM_VERSION: 'v2.35.3'
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
- name: run install-tools
run: make install-tools
- name: run lint
run: make lint
unit-test:
name: Unit Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
- name: Run Unit Tests
run: make unit-test
- name: Check Coverage
uses: vladopajic/go-test-coverage@dd4b1f21c4e48db0425e1187d2845404b1206919
with:
config: ./.testcoverage.yaml
## when token is not specified (value '') this feature is turned off
git-token: ${{ github.ref_name == 'v3' && secrets.GITHUB_TOKEN || '' }}
## name of orphaned branch where badges are stored
git-branch: badges
race-condition-test:
name: Unit tests with race condition detection
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: nginx-agent-unsigned-snapshots
path: build
retention-days: 1
generate-pgo-profile:
name: Generate Profile
needs: build-unsigned-snapshot
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
- name: Download Packages
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: nginx-agent-unsigned-snapshots
path: build
- name: Generate pgo profile
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
OS_RELEASE="ubuntu" OS_VERSION="22.04" \
make generate-pgo-profile
integration-tests:
name: Integration Tests
needs: build-unsigned-snapshot
runs-on: ubuntu-22.04
strategy:
matrix:
container:
- image: "ubuntu"
version: "22.04"
- image: "redhatenterprise"
version: "9"
- image: "alpine"
version: "3.19"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
- name: Download Packages
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: nginx-agent-unsigned-snapshots
path: build
- name: Run Integration Tests
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
OS_RELEASE="${{ matrix.container.image }}" OS_VERSION="${{ matrix.container.version }}" \
make integration-test
performance-tests:
name: Performance Tests
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
- name: Run Performance Tests
run: |
make performance-test
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@cc9ac13ce81036c9b67fcfe2cb95ca366684b9ea # v1.19.3
with:
name: Compare Benchmark Results
tool: 'go'
output-file-path: ./build/test/benchmark.txt
benchmark-data-dir-path: ""
# Set auto-push to false since GitHub API token is not given
auto-push: false
alert-threshold: '125%'
gh-pages-branch: "benchmark-results"
fail-on-alert: true
- name: Push benchmark result
if: ${{ success() && github.ref_name == 'v3'}}
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results