gorm/tests/tests_all.sh
MOREL Matthieu 21423b914f require lint before tests
use golangci/golangci-lint-action instead of reviewdog/action-golangci-lint as the second was not reporting any failures even if there was some.

Report code coverage with codecov/codecov-action
I have set some flags per dialect and go version

Several linters has been fixed, some disabled so the build can pass
2021-12-27 09:33:36 +01:00

43 lines
936 B
Bash
Executable File

#!/bin/bash -e
dialects=("sqlite" "mysql" "postgres" "sqlserver")
if [[ $(pwd) == *"gorm/tests"* ]]; then
cd ..
fi
if [ -d tests ]
then
cd tests
go get -u -t ./...
go mod download
go mod tidy
cd ..
fi
for dialect in "${dialects[@]}" ; do
if [ "$GORM_DIALECT" = "" ] || [ "$GORM_DIALECT" = "${dialect}" ]
then
echo "testing ${dialect}..."
if [ "$GORM_VERBOSE" = "" ]
then
GORM_DIALECT=${dialect} go test -race -count=1 -coverprofile=coverage.out ./...
if [ -d tests ]
then
cd tests
GORM_DIALECT=${dialect} go test -race -count=1 -coverprofile=../coverage.out ./...
cd ..
fi
else
GORM_DIALECT=${dialect} go test -race -count=1 -v -coverprofile=coverage.out ./...
if [ -d tests ]
then
cd tests
GORM_DIALECT=${dialect} go test -race -count=1 -v -coverprofile=../coverage.out ./...
cd ..
fi
fi
fi
done