Skip to content

Commit

Permalink
Use deploy-check snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
SamStudio8 committed Jun 26, 2023
1 parent 32e2e26 commit 299b992
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ include:
file: "push-github.yaml"
- project: "epi2melabs/ci-templates"
file: "push-conda.yaml"
- project: "epi2melabs/ci-templates"
file: "snippets.yaml"

image: ${UBUNTUIMAGE}:20.04

Expand All @@ -19,29 +21,13 @@ stages:
- release
- postrelease

# Insist that the version in __init__.py matches the git tag
.check-versions: &check-versions |
PYVER="v"$(grep "__version__ = " ${CI_PROJECT_NAME}/__init__.py | awk '{gsub("\"","",$3); print $3}')
TAGVER=${CI_COMMIT_TAG}
if [[ "${PYVER}" != "${TAGVER}" ]]; then
echo "Mismatching TAG and PACKAGE versions:"
echo " - TAG:'$TAGVER'"
echo " - PACKAGE:'$TAGVER'"
exit 1
else
echo "TAG and PACKAGE versions agree: '${PYVER}'"
fi
# Insist a CHANGELOG entry has been made for tags
.check-changelog: &check-changelog |
TAGVER=${CI_COMMIT_TAG}
MATCHES=$(grep -c "## \[${TAGVER}\]" CHANGELOG.md || exit 0)
if [[ "${MATCHES}" != "1" ]]; then
echo "Expected one match to '${CI_COMMIT_TAG}' in CHANGELOG, found ${MATCHES}"
exit 1
else
echo "Found CHANGELOG.md entry for tag"
fi
deploy-checks:
stage: prerelease
script:
- !reference [.check, python-version]
- !reference [.check, changelog]
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'

test:
stage: test
Expand All @@ -54,14 +40,6 @@ test:
paths:
- dist/*.tar.gz

deploy-checks:
stage: prerelease
script:
- *check-versions
- *check-changelog
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'

conda:
variables:
PACKAGE_ARCH: "noarch"
Expand Down

0 comments on commit 299b992

Please sign in to comment.