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
|
// Unit-tests
|
||||||
local unittest_stage = baseJob.QuayTest {
|
local unittest_stage = baseJob.QuayTest {
|
||||||
stage: stages.unit_tests },
|
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 {
|
'unit-tests': unittest_stage {
|
||||||
|
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
|
||||||
script: [
|
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 {
|
'registry-tests': unittest_stage {
|
||||||
script: [
|
script: [ pytest_cmd + ' ./test/registry_tests.py'],
|
||||||
'py.test --timeout=7200 --verbose --show-count ./test/registry_tests.py --color=no -x'] },
|
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
|
||||||
|
},
|
||||||
|
|
||||||
// UI tests
|
// UI tests
|
||||||
'karma-tests': unittest_stage {
|
'karma-tests': unittest_stage {
|
||||||
|
@ -85,6 +96,7 @@ local jobs = {
|
||||||
// Unit-tests with real databases
|
// Unit-tests with real databases
|
||||||
local db_stage = { stage: stages.unit_tests },
|
local db_stage = { stage: stages.unit_tests },
|
||||||
local dbname = 'quay',
|
local dbname = 'quay',
|
||||||
|
|
||||||
postgres: db_stage + baseJob.dbTest('postgresql',
|
postgres: db_stage + baseJob.dbTest('postgresql',
|
||||||
image='postgres:9.6',
|
image='postgres:9.6',
|
||||||
env={ POSTGRES_PASSWORD: dbname, POSTGRES_USER: dbname }),
|
env={ POSTGRES_PASSWORD: dbname, POSTGRES_USER: dbname }),
|
||||||
|
|
|
@ -39,8 +39,8 @@ container-release:
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
- docker pull quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
- 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 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}-${CI_COMMIT_SHA}
|
- docker push quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}
|
||||||
stage: docker_release
|
stage: docker_release
|
||||||
tags:
|
tags:
|
||||||
- kubernetes
|
- kubernetes
|
||||||
|
@ -78,8 +78,8 @@ deploy-staging:
|
||||||
before_script:
|
before_script:
|
||||||
- appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io
|
- appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io
|
||||||
- cd deploy/quay-ci-app
|
- cd deploy/quay-ci-app
|
||||||
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA} > VERSION
|
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG}-${SHA8} > 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 "{\"domain\": \"$QUAY_DOMAIN\", \"image\": \"quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}\", \"tag\": \"${CI_COMMIT_REF_SLUG}-${SHA8}\"}" > params.json'
|
||||||
- cat params.json
|
- cat params.json
|
||||||
environment:
|
environment:
|
||||||
name: staging
|
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 master
|
||||||
- appr push quay.io/quay/quay-ci-app -c beta
|
- appr push quay.io/quay/quay-ci-app -c beta
|
||||||
- appr push quay.io/quay/quay-ci-app -c latest
|
- 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
|
- kubectl get ingresses -n ci-staging -o wide
|
||||||
stage: deploy_staging
|
stage: deploy_staging
|
||||||
tags:
|
tags:
|
||||||
|
@ -123,6 +123,7 @@ mysql:
|
||||||
before_script:
|
before_script:
|
||||||
- cd $QUAYDIR
|
- cd $QUAYDIR
|
||||||
- source $QUAYDIR/venv/bin/activate
|
- source $QUAYDIR/venv/bin/activate
|
||||||
|
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||||
script:
|
script:
|
||||||
- sleep 30
|
- sleep 30
|
||||||
|
@ -148,6 +149,7 @@ postgres:
|
||||||
before_script:
|
before_script:
|
||||||
- cd $QUAYDIR
|
- cd $QUAYDIR
|
||||||
- source $QUAYDIR/venv/bin/activate
|
- source $QUAYDIR/venv/bin/activate
|
||||||
|
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||||
script:
|
script:
|
||||||
- sleep 30
|
- sleep 30
|
||||||
|
@ -171,9 +173,10 @@ registry-tests:
|
||||||
before_script:
|
before_script:
|
||||||
- cd $QUAYDIR
|
- cd $QUAYDIR
|
||||||
- source $QUAYDIR/venv/bin/activate
|
- source $QUAYDIR/venv/bin/activate
|
||||||
|
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||||
script:
|
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
|
stage: unit_tests
|
||||||
tags:
|
tags:
|
||||||
- kubernetes
|
- kubernetes
|
||||||
|
@ -214,12 +217,18 @@ stop-preview:
|
||||||
QUAY_DOMAIN: quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
|
QUAY_DOMAIN: quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
|
||||||
when: manual
|
when: manual
|
||||||
unit-tests:
|
unit-tests:
|
||||||
|
after_script:
|
||||||
|
- cp -r $QUAYDIR/htmlcov/ $CI_PROJECT_DIR/coverage
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- coverage
|
||||||
before_script:
|
before_script:
|
||||||
- cd $QUAYDIR
|
- cd $QUAYDIR
|
||||||
- source $QUAYDIR/venv/bin/activate
|
- source $QUAYDIR/venv/bin/activate
|
||||||
|
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
|
||||||
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
|
||||||
script:
|
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
|
stage: unit_tests
|
||||||
tags:
|
tags:
|
||||||
- kubernetes
|
- kubernetes
|
||||||
|
|
|
@ -106,6 +106,7 @@ function(vars={})
|
||||||
SKIP_DB_SCHEMA: 'true',
|
SKIP_DB_SCHEMA: 'true',
|
||||||
TEST_DATABASE_URI: '%s://quay:quay@localhost/quay' % scheme,
|
TEST_DATABASE_URI: '%s://quay:quay@localhost/quay' % scheme,
|
||||||
} + env,
|
} + env,
|
||||||
|
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
|
||||||
services: [image],
|
services: [image],
|
||||||
script: [
|
script: [
|
||||||
"sleep 30",
|
"sleep 30",
|
||||||
|
|
|
@ -15,12 +15,16 @@ local utils = import "utils.libsonnet";
|
||||||
|
|
||||||
// release is a copy of the quayci image to the 'prod' repository
|
// release is a copy of the quayci image to the 'prod' repository
|
||||||
release: { repo: "quay.io/quay/quay",
|
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),
|
name: utils.containerName(self.repo, self.tag),
|
||||||
},
|
},
|
||||||
|
|
||||||
quayci: { repo: "quay.io/quay/quay-ci", tag: "${CI_COMMIT_REF_SLUG}",
|
quayci: { repo: "quay.io/quay/quay-ci", tag: "${CI_COMMIT_REF_SLUG}",
|
||||||
name: utils.containerName(self.repo, self.tag),
|
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),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
16
Makefile
16
Makefile
|
@ -40,13 +40,21 @@ conf/stack/license: $(QUAY_CONFIG)/local/license
|
||||||
mkdir -p conf/stack
|
mkdir -p conf/stack
|
||||||
ln -s $(QUAY_CONFIG)/local/license conf/stack/license
|
ln -s $(QUAY_CONFIG)/local/license conf/stack/license
|
||||||
|
|
||||||
unit:
|
unit-test:
|
||||||
TEST=true PYTHONPATH="." py.test --timeout=3600 --verbose -x ./
|
TEST=true PYTHONPATH="." py.test \
|
||||||
|
--cov="." --cov-report=html --cov-report=term-missing \
|
||||||
|
--timeout=3600 --verbose -x \
|
||||||
|
./
|
||||||
|
|
||||||
test: unit test/registry_tests.py
|
registry-test:
|
||||||
TEST=true PYTHONPATH="." py.test --timeout=3600 --verbose --show-count -x \
|
TEST=true PYTHONPATH="." py.test \
|
||||||
|
--cov="." --cov-report=html --cov-report=term-missing \
|
||||||
|
--timeout=3600 --verbose --show-count -x \
|
||||||
test/registry_tests.py
|
test/registry_tests.py
|
||||||
|
|
||||||
|
test: unit-test registry-test
|
||||||
|
|
||||||
|
|
||||||
PG_PASSWORD := quay
|
PG_PASSWORD := quay
|
||||||
PG_USER := quay
|
PG_USER := quay
|
||||||
PG_HOST := postgresql://$(PG_USER):$(PG_PASSWORD)@localhost/quay
|
PG_HOST := postgresql://$(PG_USER):$(PG_PASSWORD)@localhost/quay
|
||||||
|
|
|
@ -9,7 +9,9 @@ branch = True
|
||||||
|
|
||||||
[coverage:report]
|
[coverage:report]
|
||||||
omit =
|
omit =
|
||||||
test/*
|
test/**
|
||||||
|
venv/**
|
||||||
|
**/test/**
|
||||||
|
|
||||||
[pep8]
|
[pep8]
|
||||||
ignore = E111,E114
|
ignore = E111,E114
|
||||||
|
|
Reference in a new issue