Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.93 KiB
Newer Older
Eric Müller's avatar
Eric Müller committed
stages:
Eric Müller's avatar
Eric Müller committed

variables:
Adrian Ciu's avatar
Adrian Ciu committed
  BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/esd/tmp:latest
default:
  before_script:
    - chmod +x dedal/utils/bootstrap.sh
    - ./dedal/utils/bootstrap.sh
    - pip install -e .[test]
Eric Müller's avatar
Eric Müller committed
  stage: build
  tags:
    - docker-runner
  image: python:latest
  before_script:
    - python -m pip install --upgrade pip setuptools wheel build
Eric Müller's avatar
Eric Müller committed
  script:
    - python -m build --sdist --wheel
  artifacts:
    paths:
      - dist/*.whl
      - dist/*.tar.gz
    expire_in: 1 week

unit_tests:
  stage: test
  tags:
    - docker-runner
  image: ubuntu:22.04
  script:
    - coverage run -m pytest -s --tb=short --junitxml=test-results.xml ./dedal/tests/unit_tests
    - mv .coverage .coverage.unit  # Rename to avoid overwriting
  artifacts:
    when: always
    reports:
      junit: test-results.xml
    paths:
      - test-results.xml
      - .dedal.log
      - .generate_cache.log
      - .coverage.unit
    expire_in: 1 week
  stage: test
  tags:
    - docker-runner
    - coverage run -m pytest -s --tb=short --junitxml=test-results.xml ./dedal/tests/integration_tests
    - mv .coverage .coverage.integration  # Rename to avoid overwriting
  needs: ["unit_tests"]
  artifacts:
    when: always
    reports:
      junit: test-results.xml
    paths:
      - test-results.xml
      - .coverage.integration
    expire_in: 1 week

merge_coverage:
  stage: coverage_report
  tags:
    - docker-runner
  image: ubuntu:22.04
  script:
    - coverage combine .coverage.unit .coverage.integration
    - coverage report
    - coverage xml -o coverage.xml
    - coverage html -d coverage_html
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml
    paths:
      - coverage.xml
      - coverage_html
  coverage: '/TOTAL.*?(\d+\%)$/'