Skip to content
Snippets Groups Projects
package-build.template.yml 768 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
        - CAPO_PATH=$PWD
        - CAPO_PROFILE=docker
Daniel Lyons's avatar
Daniel Lyons committed
        - WD=$PWD
        - cd ${PACKAGE_PATH}

        # Install build, poetry and pytest
Daniel Lyons's avatar
Daniel Lyons committed
        - pip install build poetry pytest fakeredis

        # Install the package for testing
        - pip install .
Daniel Lyons's avatar
Daniel Lyons committed
        - 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