/ .gitlab-ci.yml
.gitlab-ci.yml
1 image: docker.io/chips4makers/build38 2 3 variables: 4 GIT_DEPTH: 0 5 GIT_FETCH_EXTRA_FLAGS: --quiet 6 GIT_SUBMODULE_STRATEGY: recursive 7 PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" 8 PYPI_INDEX: "https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/api/v4/groups/${CI_PROJECT_NAMESPACE}/-/packages/pypi/simple" 9 cache: 10 paths: 11 - .cache/pip 12 13 before_script: 14 - python --version # For debugging 15 - pip config set global.index-url "${PYPI_INDEX}" 16 - pip install pdm 17 18 init: 19 stage: .pre 20 script: 21 - pdm update --save-minimum 22 artifacts: 23 paths: 24 - pdm.lock 25 - .pdm-python 26 - .venv 27 28 license: 29 stage: .pre 30 image: docker:latest 31 services: 32 - name: "docker:dind" 33 before_script: [] # We don't need to install our dependencies for this 34 script: 35 # Use Google's `addlicence` to check for SPDX-License-Identifier header 36 # See: https://github.com/google/addlicense 37 - docker run --platform=linux/amd64 -v ${PWD}:/src ghcr.io/google/addlicense -v -check -s=only pdkmaster test docs/src 38 # Check if license header has right format 39 - grep -r SPDX-License-Identifier pdkmaster test docs/src | if grep -q -v "AGPL-3.0-or-later OR GPL-2.0-or-later OR CERN-OHL-S-2.0+ OR Apache-2.0"; then echo "wrong SPDX header"; exit 20; fi 40 41 dco: 42 stage: .pre 43 script: 44 - python3 .ci/check-dco.py 45 46 pages_build: 47 stage: build 48 script: 49 - pdm doit docs 50 artifacts: 51 paths: 52 - docs/html 53 54 unittest: 55 stage: test 56 script: 57 - pdm doit unittest 58 - cat test/cover_report.log # Get coverage 59 60 dist: 61 stage: deploy 62 only: 63 - main 64 variables: 65 TWINE_PASSWORD: '${CI_JOB_TOKEN}' 66 TWINE_USERNAME: 'gitlab-ci-token' 67 TWINE_REPOSITORY_URL: 'https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi' 68 script: 69 # Need to fetch tags 70 - pdm build 71 - python -m twine check --strict dist/* 72 - python -m twine upload --verbose dist/* 73 artifacts: 74 paths: 75 - dist 76 77 dist-test: 78 stage: deploy 79 except: 80 - main 81 script: 82 # Need to fetch tags 83 - pdm build 84 - python -m twine check --strict dist/* 85 artifacts: 86 paths: 87 - dist 88 89 pages: 90 stage: deploy 91 only: 92 - main 93 script: 94 - mv docs/html public/ 95 artifacts: 96 paths: 97 - public