Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
36 changes: 24 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,26 @@ permissions:

env:
NFPM_VERSION: 'v2.35.3'
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev"
GOPROXY: "direct"

jobs:
set-vars:
sanity-check:
name: Sanity Check
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sanity-check:
name: Sanity Check
goproxy-sanity-check:
name: GOPROXY Sanity Check

runs-on: ubuntu-22.04
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev"
steps:
- name: Set Variables
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-tags: 'true'
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: run sanity-check
run: |
if [[ -z ${{ secrets.ARTIFACTORY_USER }} ]] ||
[[ -z ${{ secrets.ARTIFACTORY_TOKEN }} ]] ||
${{ github.event.pull_request.head.repo.fork }}; then
echo "GOPROXY=direct" >> $GITHUB_ENV
fi
make build

lint:
name: Lint
Expand All @@ -47,6 +54,7 @@ jobs:
run: make install-tools
- name: run lint
run: make lint

unit-test:
name: Unit Tests
runs-on: ubuntu-22.04
Expand All @@ -63,9 +71,10 @@ jobs:
with:
config: ./.testcoverage.yaml
## when token is not specified (value '') this feature is turned off
git-token: ${{ github.ref_name == 'v3' && secrets.GITHUB_TOKEN || '' }}
git-token: ${{ github.ref_name == 'main' && 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
Expand All @@ -77,11 +86,14 @@ jobs:
cache: false
- 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
with:
fetch-tags: 'true'
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
Expand Down Expand Up @@ -247,7 +259,7 @@ jobs:
gh-pages-branch: "benchmark-results"
fail-on-alert: true
- name: Push benchmark result
if: ${{ success() && github.ref_name == 'v3'}}
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
Expand Down Expand Up @@ -314,10 +326,10 @@ jobs:
benchmark-data-dir-path: ""
# Set auto-push to false since GitHub API token is not given
auto-push: false
alert-threshold: '175%'
alert-threshold: '125%'
gh-pages-branch: "benchmark-results"
fail-on-alert: true

- name: Push load test result
if: ${{ success() && github.ref_name == 'v3'}}
if: ${{ success() && github.ref_name == 'main' }}
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ MANIFEST_DIR ?= /var/lib/nginx-agent
DIRS = $(BUILD_DIR) $(TEST_BUILD_DIR) $(BUILD_DIR)/$(DOCS_DIR) $(BUILD_DIR)/$(DOCS_DIR)/$(PROTO_DIR)
$(shell mkdir -p $(DIRS))

VERSION ?= "v3.0.0"
VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags)
ifeq ($(strip $(VERSION)),)
VERSION := $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r)
endif
COMMIT = $(shell git rev-parse --short HEAD)
DATE = $(shell date +%F_%H-%M-%S)
LDFLAGS = "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
Expand Down Expand Up @@ -104,7 +107,6 @@ include Makefile.containers
include Makefile.packaging

.PHONY: help clean no-local-changes build lint format unit-test integration-test run dev run-mock-management-grpc-server generate generate-mocks local-apk-package local-deb-package local-rpm-package

help: ## Show help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

Expand Down