Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sec23
korte
pymagglobal
Commits
1b52e112
Commit
1b52e112
authored
May 11, 2021
by
Maximilian Schanner
Browse files
Testing new job arrangement.
parent
0af072de
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
1b52e112
...
...
@@ -7,9 +7,10 @@ image: debian:testing
stages
:
-
build
-
test
-
upload
-
test-install
-
deploy
build-job
:
stage
:
build
script
:
...
...
@@ -17,23 +18,50 @@ build-job:
-
apt-get install -y -qq python3-dev python3-pip
-
pip install twine setuptools wheel
-
python3 setup.py sdist bdist_wheel
-
apt-get install -y -qq curl --fix-missing
# get the current package id
-
'
export
ID=$(curl
--max-time
900
--connect-timeout
120
--request
GET
--header
"PRIVATE-TOKEN:
${API_ACCES_TOKEN}"
"https://git.gfz-potsdam.de/api/v4/projects/${CI_PROJECT_ID}/packages"
|
grep
-P
"(?<=.id.:)(\\d+)"
-o
|
head
-1)'
# remove the package, as we want a new build even if the version number did not change
-
'
echo
$ID'
#- 'curl --max-time 900 --connect-timeout 120 --request DELETE --header "PRIVATE-TOKEN: ${API_ACCES_TOKEN}" "https://git.gfz-potsdam.de/api/v4/projects/${CI_PROJECT_ID}/packages/$ID"'
# upload
-
TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python3 -m twine upload --repository-url https://git.gfz-potsdam.de/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/* --verbose
artifacts
:
paths
:
-
dist
only
:
changes
:
-
pymagglobal/*.py
-
pymagglobal/dat/*
-
setup.py
test-run
:
stage
:
test
script
:
-
apt-get update -y -qq
-
apt-get install -y -qq python3-dev python3-pip python3-cartopy
-
pip install pymagglobal -f dist/
-
python3 tests/run_tests.py
-
pip uninstall -y pymagglobal
-
pip install pymagglobal[tests] -f dist/
-
python3 tests/run_tests.py
only
:
changes
:
-
pymagglobal/*.py
-
pymagglobal/dat/*
-
setup.py
-
tests/*
upload-job
:
stage
:
upload
script
:
-
apt-get install -y -qq curl jq --fix-missing
# get the version that is being installed
-
'
export
version=$(grep
-oP
"(?<=__version__
=
').*" ./pymagglobal/__init__.py | head -c -2)'
-
'
echo
$version'
# get the corresponding package id
-
'
export
ID=$(curl
-s
--request
GET
--header
"PRIVATE-TOKEN:
${API_ACCES_TOKEN}"
"https://git.gfz-potsdam.de/api/v4/projects/${CI_PROJECT_ID}/packages"
|
jq
--arg
VERSION
"$version"
--raw-output
'.[] | if .version==$VERSION then .id else
null
end' | grep -v
null
)'
-
'
echo
$ID'
# remove the package, as we want a new build even if the version number did not change
-
'
curl
--max-time
900
--connect-timeout
120
--request
DELETE
--header
"PRIVATE-TOKEN:
${API_ACCES_TOKEN}"
"https://git.gfz-potsdam.de/api/v4/projects/${CI_PROJECT_ID}/packages/$ID"'
# upload
-
TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python3 -m twine upload --repository-url https://git.gfz-potsdam.de/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/* --verbose
test-conda
:
stage
:
test
stage
:
test
-install
image
:
continuumio/miniconda3
script
:
-
conda install cartopy
...
...
@@ -50,8 +78,8 @@ test-conda:
-
tests/*
test-
job
:
stage
:
test
test-
debian
:
stage
:
test
-install
script
:
-
apt-get update -y -qq
-
apt-get install -y -qq python3-dev python3-pip python3-cartopy
...
...
@@ -68,7 +96,6 @@ test-job:
-
./docs/pic_cfe.png
-
./docs/pic_cfs.png
pages
:
stage
:
deploy
script
:
...
...
Maximilian Schanner
@arthus
mentioned in issue
#19 (closed)
·
Jul 28, 2021
mentioned in issue
#19 (closed)
mentioned in issue #19
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment