Skip to content

Commit

Permalink
Run gcov/lcov via GitLab CI/CD
Browse files Browse the repository at this point in the history
Bug: #157

Downgrade gcc image for GitLab CI/CD

Lcov is not compatible with the latest
gcov output; downgrading gcc version
to use an older gcov until the issue is
resolved.

Bug: linux-test-project/lcov#58
  • Loading branch information
oxr463 committed May 9, 2019
1 parent f806239 commit 15d29b9
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 20 deletions.
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
*.d
*.o
*.gcda
*.gcno
*.html
*.info
*.o
doc/*.h
doc/public_html/
public/
src/.check_process_vm.res
src/.check_seccomp_filter.res
src/build.h
src/care
src/loader/loader
src/loader/loader-m32
src/proot
src/proot.py
src/proot_wrap.c
src/care*
src/loader*
src/proot*
tests/*
!tests/*.sh.*
!tests/*.sh
Expand Down
70 changes: 58 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,73 @@
image: gcc
image: gcc:7.4.0

stages:
- check
- dist
- coverage
- static-analysis
- deploy

before_script:
- apt-get update -qq
- apt-get install -qq clang-tools-4.0 curl libtalloc-dev uthash-dev libarchive-dev gdb strace realpath swig
- apt-get install -qq clang-tools-4.0 curl libtalloc-dev uthash-dev libarchive-dev gdb strace realpath swig lcov

test:
stage: test
check:
stage: check
script:
- make -C src proot care
- make -C tests
allow_failure: true

dist:
stage: dist
script:
- LDFLAGS="${LDFLAGS} -static" make -C src proot GIT=false
after_script:
- cp src/proot .
artifacts:
paths:
- proot

gcov:
stage: coverage
script:
- make -C src loader.exe loader-m32.exe build.h
- make -C src proot
- make -C tests || true # ignore failing tests
- CFLAGS='-Wall -Werror -O0 --coverage' LDFLAGS='-ltalloc -Wl,-z,noexecstack --coverage' make -eC src proot care
- make -C tests || true # ignore failing tests (for now)
- lcov --capture --directory src --output-file coverage.info
- genhtml coverage.info --output-directory gcov-latest
artifacts:
paths:
- gcov-latest

scan-build:
stage: static-analysis
script:
- scan-build-4.0 make -C src proot
after_script:
- cp -R /tmp/scan-build-* scan-build-latest
artifacts:
paths:
- scan-build-latest

pages:
stage: deploy
script:
- mkdir -p public/{bin,reports}
- LDFLAGS="${LDFLAGS} -static" make -C src proot GIT=false
- cp src/proot public/bin
- make -C src clean
- scan-build-4.0 make -C src proot
- cp -R /tmp/scan-build-* public/reports/scan-build-latest
- mkdir -p public/reports/{lcov,scan-build}
- cp proot public/bin/proot
- curl -o public/index.html https://gitlab.com/lramage/lramage.gitlab.io/raw/master/_layouts/redirect.html
- sed -i "s|{{ page.source_url }}|https://proot.gitlab.io/-/proot/-/jobs/${CI_JOB_ID}/artifacts/public/reports/scan-build-latest/index.html|g" public/index.html
- cp -R gcov-latest public/reports/
- cp -R scan-build-latest public/reports/
- cp public/index.html public/reports/scan-build/
- cp public/index.html public/reports/lcov/
- sed -i "s|{{ page.source_url }}|https://proot-me.github.io|g" public/index.html
- sed -i "s|{{ page.source_url }}|https://proot.gitlab.io/-/proot/-/jobs/${CI_JOB_ID}/artifacts/public/reports/scan-build-latest/index.html|g" public/reports/scan-build/index.html
- sed -i "s|{{ page.source_url }}|https://proot.gitlab.io/-/proot/-/jobs/${CI_JOB_ID}/artifacts/public/reports/gcov-latest/index.html|g" public/reports/lcov/index.html
dependencies:
- dist
- gcov
- scan-build
artifacts:
paths:
- public
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Build status
:target: https://travis-ci.org/proot-me/proot

- .. image:: https://img.shields.io/badge/scan--build-latest-yellow.svg?style=flat-square
:target: https://proot.gitlab.io/proot
:target: https://proot.gitlab.io/proot/reports/scan-build

- .. image:: https://img.shields.io/badge/lcov-latest-6688D4.svg?style=flat-square
:target: https://proot.gitlab.io/proot/reports/lcov

Manuals
=======
Expand Down

0 comments on commit 15d29b9

Please sign in to comment.