chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 #307
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: Tests 🛠️ | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
paths: | |
- '**/*.go' | |
- '**/*.yaml' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
applications-test-units: | |
name: "GoLang test units" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
goVersion: [ '1.18', '1.19', '1.20' ] | |
env: | |
WH_DEBUG: 'true' | |
REDIS_HOST: '127.0.0.1' | |
REDIS_PORT: '6379' | |
REDIS_PASSWORD: '' | |
RABBITMQ_HOST: '127.0.0.1' | |
RABBITMQ_PORT: '5672' | |
RABBITMQ_USER: 'rabbitmq' | |
RABBITMQ_PASSWORD: 'rabbitmq' | |
POSTGRES_HOST: '127.0.0.1' | |
POSTGRES_PORT: '5432' | |
POSTGRES_USER: 'postgres' | |
POSTGRES_PASSWORD: 'postgres' | |
POSTGRES_DB: 'postgres' | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Start Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: 6 | |
- name: Setup RabbitMQ | |
uses: getong/[email protected] | |
with: | |
rabbitmq version: '3.8.2-management-alpine' | |
host port: 5672 | |
rabbitmq user: 'rabbitmq' | |
rabbitmq password: 'rabbitmq' | |
- name: Setup PostgreSQL | |
uses: harmon758/postgresql-action@v1 | |
with: | |
postgresql version: '11' | |
postgresql db: postgres | |
postgresql user: postgres | |
postgresql password: postgres | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.goVersion }} | |
check-latest: true | |
- name: golangci-lint | |
uses: golangci/[email protected] | |
with: | |
version: latest | |
- name: Run Unit tests | |
run: make test-units | |
- name: Quality Gate - Test coverage shall be above threshold | |
env: | |
TESTCOVERAGE_THRESHOLD: 90 | |
run: | | |
echo "Quality Gate: checking test coverage is above threshold ..." | |
echo "Threshold : $TESTCOVERAGE_THRESHOLD %" | |
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` | |
echo "Current test coverage : $totalCoverage %" | |
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then | |
echo "OK" | |
else | |
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." | |
echo "Failed" | |
exit 1 | |
fi | |
- uses: codecov/codecov-action@v4 | |
- name: Run Go Build | |
run: make build | |
integration-tests: | |
name: "Integration tests" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
goVersion: [ '1.18', '1.19', '1.20' ] | |
env: | |
WH_DEBUG: 'true' | |
REDIS_HOST: '127.0.0.1' | |
REDIS_PORT: '6379' | |
REDIS_PASSWORD: '' | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Start Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: 6 | |
- name: Run Integration tests | |
run: | | |
make run-integration >/dev/null 2>&1 & | |
until $(curl --output /dev/null --silent --head --fail http://localhost:8080/metrics); do | |
printf '.' | |
sleep 1 | |
done | |
make test-integrations |