Commit 25922116 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Separate before script in ubuntu jobs

parent c83b0e45
Loading
Loading
Loading
Loading
+42 −26
Original line number Diff line number Diff line
@@ -5,16 +5,20 @@ include:
####################################################################################################
#                                               BUILD
####################################################################################################

.setup:build:ubuntu_python:
  before_script:
    - !reference [.retrieve_deps:apt, script]
    - DEPENDENCY_JOB="build:ubuntu_python"
    - !reference [.ubuntu:download:artifacts, before_script]
    - python3 -m pip install virtualenv

build:ubuntu_python:
  stage: build
  needs: []
  tags:
    - docker
  before_script: &setup_ubuntu_build
    - !reference [.retrieve_deps:apt, script]
    - DEPENDENCY_JOB="build:ubuntu_python"
    - !reference [.ubuntu:download:artifacts, before_script]
    - python3 -m pip install virtualenv
  extends: .setup:build:ubuntu_python

  script:
    - virtualenv venv
@@ -33,6 +37,15 @@ build:ubuntu_python:
####################################################################################################
#                                               TEST
####################################################################################################

.setup:test:ubuntu_python:
  before_script:
    - !reference [.retrieve_deps:apt, script]
    - source venv/bin/activate
    - python -m pip install pytest
    - which python
    - python -m pip list

test:ubuntu_python:
  stage: test
  needs: ["build:ubuntu_python"]
@@ -41,16 +54,12 @@ test:ubuntu_python:
    - allow_failure: false
  tags:
    - docker
  before_script: &setup_ubuntu_test
    - !reference [.retrieve_deps:apt, script]
    - source venv/bin/activate
    - python -m pip install pytest
    - which python
    - python -m pip list
    - >
      if [[ "$CI_PROJECT_NAME" == "aidge_onnx" ]]; then
        python -m pip install requests onnxruntime>=1.18.0
      fi
  extends: .setup:test:ubuntu_python
  # before_script: &setup_ubuntu_test
  #   - >
  #     if [[ "$CI_PROJECT_NAME" == "aidge_onnx" ]]; then
  #       python -m pip install requests onnxruntime>=1.18.0
  #     fi
  script:
    - cd ${CI_PROJECT_NAME}
    # Run on discovery all tests located in project/unit_tests/python and discard the stdout
@@ -65,23 +74,30 @@ test:ubuntu_python:
####################################################################################################
#                                               COVERAGE
####################################################################################################

.setup:coverage:ubuntu_python:
  before_script:
    - !reference [.retrieve_deps:apt, script]
    - source venv/bin/activate
    - which python
    - python -m pip list
    - python -m pip install numpy coverage requests

coverage:ubuntu_python:
  stage: coverage
  needs: ["build:ubuntu_python"]
  extends: .rules:static_analysis_coverage
  extends:
    - .rules:static_analysis_coverage
    - .setup:coverage:ubuntu_python
  tags:
    - docker

  before_script: &setup_ubuntu_cov
    - !reference [.retrieve_deps:apt, script]
    - source venv/bin/activate
    - which python
    - python -m pip list
    - python -m pip install numpy coverage requests unittest-xml-reporting
    - >
      if [[ "$CI_PROJECT_NAME" == "aidge_onnx" ]]; then
        python -m pip install pytest onnxruntime>=1.18.0
      fi
  # before_script: &setup_ubuntu_cov

  #   - >
  #     if [[ "$CI_PROJECT_NAME" == "aidge_onnx" ]]; then
  #       python -m pip install pytest onnxruntime>=1.18.0
  #     fi
  script:
    - cd ${CI_PROJECT_NAME}
    # Retrieve the installation path of the module, since it is installed with pip.