Skip to content
Snippets Groups Projects

ci: add Conda tests and refactor

Merged Alex Kanitz requested to merge ci_conda into main
2 files
+ 50
16
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 49
16
@@ -6,27 +6,60 @@ workflow:
@@ -6,27 +6,60 @@ workflow:
rules:
rules:
- if: $CI_PIPELINE_SOURCE == "push"
- if: $CI_PIPELINE_SOURCE == "push"
test:
stages:
rules:
- build
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
- test
 
- publish
 
 
build_conda:
 
stage: build
 
script:
 
- mamba env create --force -f environment.yml
 
- echo $CONDA_DEFAULT_ENV
 
 
build_docker:
 
stage: build
 
before_script:
 
- export IMAGE="${DOCKER_ORG}/${DOCKER_REPO}"
 
- export BUILD_TAG="build"
 
- echo "IMAGE=$IMAGE" >> build.env
 
- echo "BUILD_TAG=$BUILD_TAG" >> build.env
 
script:
 
- docker build -t ${IMAGE}:${BUILD_TAG} .
 
artifacts:
 
reports:
 
dotenv: build.env
 
 
test_conda:
 
stage: test
 
needs:
 
job: build_conda
 
before_script:
 
- conda activate ascii-alignment-pileup
 
script:
 
- tests/test.sh
 
 
test_docker:
 
stage: test
 
needs:
 
- job: build_docker
 
artifacts: true
script:
script:
- export IMAGE="${DOCKER_ORG}/${DOCKER_REPO}:latest"
- docker run --rm ${IMAGE}:${BUILD_TAG} tests/test.sh
- docker build -t $IMAGE .
- docker run --rm $IMAGE tests/test.sh
test_and_publish:
publish_docker:
 
stage: publish
rules:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
needs:
 
- job: build_docker
 
artifacts: true
 
- job: test_docker
 
before_script:
- export VERSION=$(grep 'version <-' ascii_alignment_pileup.R | cut -f2 -d'"')
- export VERSION=$(grep 'version <-' ascii_alignment_pileup.R | cut -f2 -d'"')
- export IMAGE="${DOCKER_ORG}/${DOCKER_REPO}"
script:
- |
docker build \
-t ${IMAGE}:${VERSION} \
--build-arg version=$VERSION \
.
- docker run --rm ${IMAGE}:${VERSION} tests/test.sh
- echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USER}" --password-stdin
- echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USER}" --password-stdin
- docker tag ${IMAGE}:${VERSION} ${IMAGE}:latest
- docker tag ${IMAGE}:${BUILD_TAG} ${IMAGE}:${VERSION}
 
- docker tag ${IMAGE}:${BUILD_TAG} ${IMAGE}:latest
- docker push ${IMAGE}:${VERSION}
- docker push ${IMAGE}:${VERSION}
- docker push ${IMAGE}:latest
- docker push ${IMAGE}:latest
Loading