Skip to content
Snippets Groups Projects
package-build.template.yml 840 B
Newer Older
# CI Build Template
Daniel Lyons's avatar
Daniel Lyons committed
.build-package:
    image: python:3.10
    script:
Daniel Lyons's avatar
Daniel Lyons committed
        - export CAPO_PATH=$PWD
        - export CAPO_PROFILE=docker
Daniel Lyons's avatar
Daniel Lyons committed
        - WD=$PWD
        - cd ${PACKAGE_PATH}

        # Install build, poetry and pytest
        - pip install poetry
        - poetry env use $(which python3)
Daniel Lyons's avatar
Daniel Lyons committed
        - poetry install --with test
Daniel Lyons's avatar
Daniel Lyons committed
        - $(poetry env info -p)/bin/pytest test

        # Build the package and push to the gitlab repo
        - poetry build
        - poetry config repositories.gitlab "https://gitlab.nrao.edu/api/v4/projects/$CI_PROJECT_ID/packages/pypi"
        - poetry config http-basic.gitlab gitlab-ci-token "$CI_JOB_TOKEN"
        - poetry publish --repository gitlab
Daniel Lyons's avatar
Daniel Lyons committed
        - cd $WD