Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mednet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
medai
software
mednet
Commits
a5cd221a
Commit
a5cd221a
authored
10 months ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[ci] Use central biosignal CI file
parent
1b9d2c4c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!33
Full dev environment based on pixi-only
Pipeline
#86564
passed
10 months ago
Stage: qa
Stage: test
Stage: doc
Stage: dist
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+4
-246
4 additions, 246 deletions
.gitlab-ci.yml
with
4 additions
and
246 deletions
.gitlab-ci.yml
+
4
−
246
View file @
a5cd221a
...
...
@@ -2,249 +2,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
workflow
:
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
-
if
:
'
$CI_PIPELINE_SOURCE
==
"web"'
-
if
:
'
$CI_COMMIT_BRANCH
==
$CI_DEFAULT_BRANCH'
-
if
:
$CI_COMMIT_TAG
variables
:
PYTHONUNBUFFERED
:
"
1"
OMP_NUM_THREADS
:
1
# for pytorch CI tests on docker platform
GIT_SUBMODULE_STRATEGY
:
normal
GIT_SUBMODULE_DEPTH
:
1
XDG_CACHE_HOME
:
"
${CI_PROJECT_DIR}/_cache"
XDG_CONFIG_HOME
:
"
${CI_PROJECT_DIR}/_config"
PIXI_HOME
:
"
${CI_PROJECT_DIR}/_pixi"
PIXI_FROZEN
:
true
.snippets
:
setup-pixi
:
-
mkdir -p ${XDG_CACHE_HOME}/pixi
-
mkdir -p ${XDG_CONFIG_HOME}/pixi
# global configuration for pixi
# https://pixi.sh/latest/advanced/global_configuration/#reference
-
|
cat << 'EOF' > ${XDG_CONFIG_HOME}/pixi/config.toml
change_ps1 = false
tls_no_verify = true
[mirrors]
"https://conda.anaconda.org/conda-forge" = [ "http://bobconda.lab.idiap.ch:8080/conda-forge" ]
EOF
-
pixi info
-
export PATH=${PIXI_HOME}/bin:${PATH}
-
pixi global install git
# returns a comma-separated list of supported environments
-
|
function pixi_environments() { \
local array=($(pixi --color=never info | sed -e '/Environment:/!d;s/^ *Environment: //')); \
printf -v joined '%s,' "${array[@]}"; \
echo "${joined%,}"; \
}
# returns a comma-separated list of supported tasks
-
|
function pixi_tasks() { \
local array=($(pixi --color=never task list | sed 's/* //;/^$/d')); \
printf -v joined '%s,' "${array[@]}"; \
echo "${joined%,}"; \
}
# returns the first occurence of a string in an array, or not-found
# usage: has_any_string arr1,arr2,arr3 arr1,arr2 -> arr1
# usage: has_any_string arr1,arr2,arr3 arr3,arr2 -> arr3
# usage: has_any_string arr1,arr2,arr3 arr -> not-found
-
|
function has_any_string() { \
local array=(`echo ${1//,/ }`); \
local matches=(`echo ${2//,/ }`); \
for i in "${matches[@]}"; do \
if [[ " ${array[*]} " =~ [[:space:]]${i}[[:space:]] ]]; then \
echo $i; \
return; \
fi; \
done; \
echo "not-found"; \
}
# declare pixi_run function to run a task on a given environment, with
# multiple choices. It emits a green coloured output to the logs if both
# the environmetn and the task exist, otherwise it complains with a red
# log.
# usage: pixi_run env1,env2,env3 task1,task2,task3
-
|
function pixi_run { \
local _env=$(has_any_string $(pixi_environments) "$1"); \
local _task=$(has_any_string $(pixi_tasks) "$2"); \
if [[ ${_env} == "not-found" || ${_task} == "not-found" ]]; then \
echo -e "\e[1m--> missing environment or task for: \e[31mpixi run -e $1 $2\e[0m"; \
exit 1; \
else \
echo -e "\e[1m--> \e[32mpixi run -e ${_env} ${_task}\e[0m"; \
pixi run -e ${_env} ${_task}; \
fi \
}
# declare pixi_run_if_exists function to run a task on a given
# environment, with multiple choices, if the function exists. It emits a
# green coloured output to the logs if both the environmetn and the task
# exist, otherwise it warns with an yellow log.
# usage: pixi_run env1,env2,env3 task1,task2,task3
-
|
function pixi_run_if_exists { \
local _env=$(has_any_string $(pixi_environments) "$1"); \
local _task=$(has_any_string $(pixi_tasks) "$2"); \
if [[ ${_env} == "not-found" || ${_task} == "not-found" ]]; then \
echo -e "\e[1m--> missing environment or task for: \e[33mpixi run -e $1 $2\e[0m"; \
else \
echo -e "\e[1m--> \e[32mpixi run -e ${_env} ${_task}\e[0m"; \
pixi run -e ${_env} ${_task}; \
fi \
}
apt-install-libgl
:
# apt install libgl1-mesa-glx for grad-cam
-
|
if [[ ${CI_RUNNER_TAGS} =~ '"docker"' ]]; then \
apt update; \
apt install -y libgl1-mesa-glx > /dev/null; \
fi
default
:
tags
:
-
bob
-
docker
image
:
ghcr.io/prefix-dev/pixi:latest
# do not cache pixi installs as we already have a reverse proxying cache
# cache:
# key:
# files:
# - pixi.lock
# paths:
# - .pixi # project packages
before_script
:
-
!reference
[
.snippets
,
setup-pixi
]
stages
:
-
qa
-
test
-
doc
-
dist
-
deploy
quality
:
stage
:
qa
rules
:
-
exists
:
-
.pre-commit-config.yaml
cache
:
key
:
pre-commit
paths
:
-
_cache/pre-commit
script
:
-
pixi_run qa-ci,default qa-ci,qa
tests
:
stage
:
test
parallel
:
matrix
:
-
PYTHON
:
[
"
3.12"
,
"
3.11"
]
TAG
:
[
"
docker"
,
"
macos-arm"
]
tags
:
-
bob
-
${TAG}
needs
:
-
job
:
quality
optional
:
true
before_script
:
-
!reference
[
.snippets
,
setup-pixi
]
-
!reference
[
.snippets
,
apt-install-libgl
]
script
:
-
pixi_run test-ci-${PYTHON//\./},default test-ci,test-cov,test
coverage
:
'
/(?:TOTAL|total|Total).*?
(100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts
:
paths
:
-
html
reports
:
junit
:
junit-coverage.xml
coverage_report
:
coverage_format
:
cobertura
path
:
coverage.xml
documentation
:
stage
:
doc
rules
:
-
exists
:
-
doc/conf.py
needs
:
-
job
:
quality
optional
:
true
before_script
:
-
!reference
[
.snippets
,
setup-pixi
]
-
!reference
[
.snippets
,
apt-install-libgl
]
script
:
-
pixi_run doc-ci,default doc-ci,doc
-
pixi_run_if_exists doc-ci,default doctest-ci,doctest
artifacts
:
paths
:
-
html
python-package
:
stage
:
dist
needs
:
-
tests
script
:
-
pixi_run build-ci,default build-ci,build
-
pixi_run_if_exists build-ci,default check-ci,check
artifacts
:
paths
:
-
dist
docker-image
:
stage
:
dist
needs
:
-
tests
image
:
docker:latest
services
:
-
docker:dind
rules
:
# conditions:
# - the variable $CI_REGISTRY must be defined (package has a container
# image registry)
# - a file named "Dockerfile" exists on the root of the repository
-
if
:
($CI_REGISTRY !=
null
)
exists
:
-
Dockerfile
before_script
:
-
docker info
script
:
-
docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
-
docker build -t ${CI_REGISTRY_IMAGE}:latest .
-
>
# upload image to registry if on main dev branch or tag
if [ "${CI_COMMIT_BRANCH}" == "${CI_DEFAULT_BRANCH}" ]; then \
docker push ${CI_REGISTRY_IMAGE}:latest; \
if [ -n "${CI_COMMIT_TAG}" ]; then \
docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} .; \
docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}; \
fi \
fi
pypi
:
stage
:
deploy
needs
:
-
python-package
rules
:
# conditions:
# - only for tags in PEP-440 style (on any branch)
# - only for public packages
# - the variable $PYPI_TOKEN must be defined
-
if
:
($CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+([abc]\d*)?$/ && $CI_PROJECT_VISIBILITY == "public" && $PYPI_TOKEN !=
null
)
variables
:
TWINE_USERNAME
:
"
__token__"
TWINE_PASSWORD
:
"
${PYPI_TOKEN}"
script
:
-
pixi_run build-ci,default upload-ci,upload
include
:
-
project
:
'
biosignal/templates/ci'
ref
:
main
file
:
'
python.yml'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment