add coverage report
This commit is contained in:
parent
90ed0c28be
commit
851686dd0b
7 changed files with 58 additions and 18 deletions
4
.coverage.dockerfile
Normal file
4
.coverage.dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM nginx:alpine
|
||||
MAINTAINER Antoine Legrand <2t.antoine@gmail.com>
|
||||
COPY . /usr/share/nginx/html
|
||||
EXPOSE 80
|
|
@ -64,13 +64,24 @@ local jobs = {
|
|||
// Unit-tests
|
||||
local unittest_stage = baseJob.QuayTest {
|
||||
stage: stages.unit_tests },
|
||||
local pytest_cmd = 'py.test --cov="." --cov-report=html --cov-report=term-missing' +
|
||||
' --timeout=3600 --verbose -x --color=no --show-count ',
|
||||
'unit-tests': unittest_stage {
|
||||
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
|
||||
script: [
|
||||
'py.test --timeout=7200 --verbose --show-count ./ --color=no -x'] },
|
||||
pytest_cmd + ' ./',],
|
||||
after_script: [
|
||||
'cp -r $QUAYDIR/htmlcov/ $CI_PROJECT_DIR/coverage'
|
||||
],
|
||||
artifacts: {
|
||||
paths: ['coverage',]
|
||||
}
|
||||
},
|
||||
|
||||
'registry-tests': unittest_stage {
|
||||
script: [
|
||||
'py.test --timeout=7200 --verbose --show-count ./test/registry_tests.py --color=no -x'] },
|
||||
script: [ pytest_cmd + ' ./test/registry_tests.py'],
|
||||
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
|
||||
},
|
||||
|
||||
// UI tests
|
||||
'karma-tests': unittest_stage {
|
||||
|
@ -85,6 +96,7 @@ local jobs = {
|
|||
// Unit-tests with real databases
|
||||
local db_stage = { stage: stages.unit_tests },
|
||||
local dbname = 'quay',
|
||||
|
||||
postgres: db_stage + baseJob.dbTest('postgresql',
|
||||
image='postgres:9.6',
|
||||
env={ POSTGRES_PASSWORD: dbname, POSTGRES_USER: dbname }),
|
||||
|
|
|
@ -39,8 +39,8 @@ container-release:
|
|||
- tags
|
||||
script:
|
||||
- docker pull quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||
- docker tag quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}
|
||||
- docker push quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}
|
||||
- docker tag quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}
|
||||
- docker push quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}
|
||||
stage: docker_release
|
||||
tags:
|
||||
- kubernetes
|
||||
|
@ -78,8 +78,8 @@ deploy-staging:
|
|||
before_script:
|
||||
- appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io
|
||||
- cd deploy/quay-ci-app
|
||||
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA} > VERSION
|
||||
- 'echo "{\"domain\": \"$QUAY_DOMAIN\", \"image\": \"quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}\", \"tag\": \"${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}\"}" > params.json'
|
||||
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG}-${SHA8} > VERSION
|
||||
- 'echo "{\"domain\": \"$QUAY_DOMAIN\", \"image\": \"quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}\", \"tag\": \"${CI_COMMIT_REF_SLUG}-${SHA8}\"}" > params.json'
|
||||
- cat params.json
|
||||
environment:
|
||||
name: staging
|
||||
|
@ -92,7 +92,7 @@ deploy-staging:
|
|||
- appr push quay.io/quay/quay-ci-app -c master
|
||||
- appr push quay.io/quay/quay-ci-app -c beta
|
||||
- appr push quay.io/quay/quay-ci-app -c latest
|
||||
- appr deploy quay.io/quay/quay-ci-app@1.0.0-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA} --namespace ci-staging -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS
|
||||
- appr deploy quay.io/quay/quay-ci-app@1.0.0-${CI_COMMIT_REF_SLUG}-${SHA8} --namespace ci-staging -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS
|
||||
- kubectl get ingresses -n ci-staging -o wide
|
||||
stage: deploy_staging
|
||||
tags:
|
||||
|
@ -123,6 +123,7 @@ mysql:
|
|||
before_script:
|
||||
- cd $QUAYDIR
|
||||
- source $QUAYDIR/venv/bin/activate
|
||||
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||
script:
|
||||
- sleep 30
|
||||
|
@ -148,6 +149,7 @@ postgres:
|
|||
before_script:
|
||||
- cd $QUAYDIR
|
||||
- source $QUAYDIR/venv/bin/activate
|
||||
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||
script:
|
||||
- sleep 30
|
||||
|
@ -171,9 +173,10 @@ registry-tests:
|
|||
before_script:
|
||||
- cd $QUAYDIR
|
||||
- source $QUAYDIR/venv/bin/activate
|
||||
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||
script:
|
||||
- py.test --timeout=7200 --verbose --show-count ./test/registry_tests.py --color=no -x
|
||||
- py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./test/registry_tests.py
|
||||
stage: unit_tests
|
||||
tags:
|
||||
- kubernetes
|
||||
|
@ -214,12 +217,18 @@ stop-preview:
|
|||
QUAY_DOMAIN: quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
|
||||
when: manual
|
||||
unit-tests:
|
||||
after_script:
|
||||
- cp -r $QUAYDIR/htmlcov/ $CI_PROJECT_DIR/coverage
|
||||
artifacts:
|
||||
paths:
|
||||
- coverage
|
||||
before_script:
|
||||
- cd $QUAYDIR
|
||||
- source $QUAYDIR/venv/bin/activate
|
||||
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||
script:
|
||||
- py.test --timeout=7200 --verbose --show-count ./ --color=no -x
|
||||
- py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./
|
||||
stage: unit_tests
|
||||
tags:
|
||||
- kubernetes
|
||||
|
|
|
@ -106,6 +106,7 @@ function(vars={})
|
|||
SKIP_DB_SCHEMA: 'true',
|
||||
TEST_DATABASE_URI: '%s://quay:quay@localhost/quay' % scheme,
|
||||
} + env,
|
||||
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
|
||||
services: [image],
|
||||
script: [
|
||||
"sleep 30",
|
||||
|
|
|
@ -15,12 +15,16 @@ local utils = import "utils.libsonnet";
|
|||
|
||||
// release is a copy of the quayci image to the 'prod' repository
|
||||
release: { repo: "quay.io/quay/quay",
|
||||
tag: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}",
|
||||
tag: "${CI_COMMIT_REF_SLUG}-${SHA8}",
|
||||
name: utils.containerName(self.repo, self.tag),
|
||||
},
|
||||
|
||||
quayci: { repo: "quay.io/quay/quay-ci", tag: "${CI_COMMIT_REF_SLUG}",
|
||||
name: utils.containerName(self.repo, self.tag),
|
||||
},
|
||||
|
||||
coverage: { repo: "quay.io/quay/quay-coverage", tag: "${CI_COMMIT_REF_SLUG}",
|
||||
name: utils.containerName(self.repo, self.tag),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
18
Makefile
18
Makefile
|
@ -40,12 +40,20 @@ conf/stack/license: $(QUAY_CONFIG)/local/license
|
|||
mkdir -p conf/stack
|
||||
ln -s $(QUAY_CONFIG)/local/license conf/stack/license
|
||||
|
||||
unit:
|
||||
TEST=true PYTHONPATH="." py.test --timeout=3600 --verbose -x ./
|
||||
unit-test:
|
||||
TEST=true PYTHONPATH="." py.test \
|
||||
--cov="." --cov-report=html --cov-report=term-missing \
|
||||
--timeout=3600 --verbose -x \
|
||||
./
|
||||
|
||||
registry-test:
|
||||
TEST=true PYTHONPATH="." py.test \
|
||||
--cov="." --cov-report=html --cov-report=term-missing \
|
||||
--timeout=3600 --verbose --show-count -x \
|
||||
test/registry_tests.py
|
||||
|
||||
test: unit-test registry-test
|
||||
|
||||
test: unit test/registry_tests.py
|
||||
TEST=true PYTHONPATH="." py.test --timeout=3600 --verbose --show-count -x \
|
||||
test/registry_tests.py
|
||||
|
||||
PG_PASSWORD := quay
|
||||
PG_USER := quay
|
||||
|
|
|
@ -9,7 +9,9 @@ branch = True
|
|||
|
||||
[coverage:report]
|
||||
omit =
|
||||
test/*
|
||||
test/**
|
||||
venv/**
|
||||
**/test/**
|
||||
|
||||
[pep8]
|
||||
ignore = E111,E114
|
||||
|
@ -17,4 +19,4 @@ max-line-length = 100
|
|||
|
||||
[flake8]
|
||||
ignore = E111,E114
|
||||
max-line-length = 100
|
||||
max-line-length = 100
|
||||
|
|
Reference in a new issue