mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
updating CI process + tests for code coverage
This commit is contained in:
@@ -8,4 +8,5 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- run: make lint
|
||||
- run: make tests
|
||||
- run: make tests CODE_COVERAGE=1
|
||||
- run: bash <(curl -s https://codecov.io/bash)
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
.idea
|
||||
.idea
|
||||
coverage.txt
|
||||
4
Makefile
4
Makefile
@@ -4,6 +4,7 @@ DOCKER_USER=
|
||||
DOCKER_PASSWORD=
|
||||
DOCKER_REPOSITORY=thecodingmachine
|
||||
GOLANGCI_LINT_VERSION=1.17.1
|
||||
CODE_COVERAGE=0
|
||||
MAXIMUM_WAIT_TIMEOUT=30.0
|
||||
MAXIMUM_WAIT_DELAY=10.0
|
||||
MAXIMUM_WEBHOOK_URL_TIMEOUT=30.0
|
||||
@@ -37,8 +38,7 @@ lint:
|
||||
# run all tests.
|
||||
tests:
|
||||
make workspace
|
||||
docker build -t $(DOCKER_REPOSITORY)/gotenberg:tests -f build/tests/Dockerfile .
|
||||
docker run --rm $(DOCKER_REPOSITORY)/gotenberg:tests
|
||||
./scripts/tests.sh $(DOCKER_REPOSITORY) $(CODE_COVERAGE)
|
||||
|
||||
# generate documentation.
|
||||
doc:
|
||||
|
||||
@@ -14,4 +14,8 @@ fi
|
||||
go run github.com/thecodingmachine/gotenberg/test/cmd/pm2
|
||||
|
||||
# Run our tests.
|
||||
go test -race -cover ./...
|
||||
if [ "$CODE_COVERAGE" = "1" ]; then
|
||||
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
else
|
||||
go test -race -cover ./...
|
||||
fi
|
||||
15
scripts/tests.sh
Executable file
15
scripts/tests.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DOCKER_REPOSITORY="$1"
|
||||
CODE_COVERAGE="$2"
|
||||
|
||||
touch "$PWD/coverage.txt"
|
||||
docker build -t "$DOCKER_REPOSITORY/gotenberg:tests" -f build/tests/Dockerfile .
|
||||
|
||||
if [ "$CODE_COVERAGE" = "1" ]; then
|
||||
docker run --rm -e "CODE_COVERAGE=$CODE_COVERAGE" -v "$PWD/coverage.txt:/gotenberg/tests/coverage.txt" "$DOCKER_REPOSITORY/gotenberg:tests"
|
||||
else
|
||||
docker run --rm -e "CODE_COVERAGE=$CODE_COVERAGE" "$DOCKER_REPOSITORY/gotenberg:tests"
|
||||
fi
|
||||
Reference in New Issue
Block a user