diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c6a55d59eefa12991211c1162d8305fbdc86430..2b9317ca45d22c9b8df8cd182ae59e42e20ddaaa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,136 +1,43 @@ -stages: - - style - - test - - build - - test_build - - deploy +include: + - remote: https://gitlab.esrf.fr/workflow/ewoks/ewoks/raw/main/.gitlab-ci-template.yml -### Job templates ### - -.base: - only: - refs: - - main - - merge_requests - timeout: 10m - -.base-linux: - extends: .base - image: "docker-registry.esrf.fr/dau/ewoks:python_3.7" - tags: - - linux - -.base-win: - extends: .base - tags: - - win - before_script: - - SET "PATH=C:\\python\\%PYTHON_VER%;C:\\python\\%PYTHON_VER%\\Scripts;%PATH%" - - python -m venv --clear build_venv - - call "build_venv\\Scripts\\activate.bat" - - python --version - - python -m pip install --upgrade pip - - python -m pip install --upgrade setuptools - after_script: - - rmdir build_venv /s /q - variables: - PYTHON_VER: "3.8" +.local_scripts: + test: + # Freezing issues: + # https://pytest-cov.readthedocs.io/en/latest/subprocess-support.html + - python -m pip install --pre .[test] + - python -m pytest -v . -.deploy-linux: - extends: .base-linux - only: - refs: - - main +test-3.6: + extends: .test-3.6 + script: + - !reference [.local_scripts, test] -.deploy-win: - extends: .base-win - only: - refs: - - main +test-3.7: + extends: .test-3.7 + script: + - !reference [.local_scripts, test] -### Jobs ### +build_sdist: + extends: .build_sdist -style: - stage: style - extends: .base-linux - before_script: - - python3 -m pip install flake8 black - script: - - LC_ALL=C.UTF-8 black --check --safe . - - flake8 +test_sdist-3.6: + extends: .test_sdist-3.6 -test-linux: - stage: test - extends: .base-linux - before_script: - - python3 -m pip install pytest-cov - - python3 -m pip install .[test] - script: - # Freezing issues: - # https://pytest-cov.readthedocs.io/en/latest/subprocess-support.html - # - python3 -m pytest --cov=./ . -v - - python3 -m pytest . -v +test_sdist-3.7: + extends: .test_sdist-3.7 -test-win: - stage: test - extends: .base-win - before_script: - - !reference [.base-win, before_script] - - python -m pip install .[test] - script: - - python -m pytest . -v +test_sdist-3.8-win: + extends: .test_sdist-3.8-win -build: - stage: build - extends: .deploy-linux - before_script: - - rm -rf ${ARTIFACTS_DEST} - script: - - python3 setup.py sdist - after_script: - - mv ${ARTIFACTS_SOURCE} ${ARTIFACTS_DEST} - artifacts: - paths: - - sdist/ - when: on_success - expire_in: 2h - variables: - ARTIFACTS_SOURCE: dist - ARTIFACTS_DEST: sdist +test_sdist-3.9: + extends: .test_sdist-3.9 -test-build-linux: - stage: test_build - extends: .deploy-linux - script: - - ls sdist - - export REQ_SPECIFIER=$(ls sdist/*.tar.gz)[test] - - echo REQ_SPECIFIER=${REQ_SPECIFIER} - - python3 -m pip install --pre ${REQ_SPECIFIER} - - python3 -m pytest -v --pyargs ${CI_PROJECT_NAME}.test +build_doc: + extends: .build_doc -test-build-win: - stage: test_build - extends: .deploy-win - script: - - dir sdist - - FOR %%F IN (sdist\*.tar.gz) DO ( - set REQ_SPECIFIER=%%F[test] - ) - - echo REQ_SPECIFIER=%REQ_SPECIFIER% - - python -m pip install --pre %REQ_SPECIFIER% - - python -m pytest -v --pyargs %CI_PROJECT_NAME%.test +pages: + extends: .pages assets: - stage: deploy - extends: .deploy-linux - script: - - rm -rf assets - - mkdir assets - - mv sdist/* assets/ - after_script: - - ls -Rl assets - artifacts: - paths: - - assets - when: on_success - expire_in: 2h + extends: .assets