update file node configuration to provide S3 credentials and force path style #32
Workflow file for this run
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
on: | |
pull_request: | |
branches: | |
- main | |
name: coverage | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: | |
- 1.19.5 | |
env: | |
GOPRIVATE: github.com/anyproto | |
# redis for tests | |
services: | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '${{ matrix.go-version }}' | |
- name: git config | |
run: git config --global url.https://${{ secrets.ANYTYPE_PAT }}@github.com/.insteadOf https://github.com/ | |
# cache {{ | |
- id: go-cache-paths | |
run: | | |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.go-cache-paths.outputs.GOCACHE }} | |
${{ steps.go-cache-paths.outputs.GOMODCACHE }} | |
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ matrix.go-version }}- | |
# }} | |
- name: deps | |
run: make deps CGO_ENABLED=0 | |
- name: unit tests | |
run: make test CGO_ENABLED=0 | |
- name: Quality Gate - Test coverage shall be above threshold | |
env: | |
TESTCOVERAGE_THRESHOLD: 0 | |
run: | | |
go test ./... -coverprofile coverage.out -covermode count | |
go tool cover -func coverage.out | |
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 |