Merge v1.0.0-rc2: Leaky Bucket Algorithm, Version Retractions, and Enhanced Testing Suite #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis:6.2 | |
ports: | |
- 6379:6379 | |
options: --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 5s --health-retries 5 | |
strategy: | |
matrix: | |
go-version: ['1.21.x'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Install Dependencies | |
run: go mod download | |
- name: Wait for Redis | |
run: | | |
for i in {1..10}; do | |
(echo > /dev/tcp/localhost/6379) >/dev/null 2>&1 && break | |
sleep 1 | |
done | |
- name: Run Linters | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54.2 | |
args: --timeout=5m | |
- name: Run Tests | |
env: | |
REDIS_ADDR: localhost:6379 | |
run: go test -race -v ./... | |
- name: Run Benchmarks | |
run: go test -bench=. -run=^$ ./... | |
- name: Generate Coverage Report | |
run: go test -coverprofile=coverage.out ./... | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.out | |
flags: unittests | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Build | |
run: go build ./... | |
- name: Security Scan | |
run: go list -m all | go run golang.org/x/vuln/cmd/govulncheck@latest |