Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gvec_to_python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
gvec-group
gvec_to_python
Commits
c195d516
Commit
c195d516
authored
2 years ago
by
Stefan Possanner
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-deploy' into 'master'
Add stages to ci See merge request
!16
parents
8c495a03
324ab029
No related branches found
No related tags found
1 merge request
!16
Add stages to ci
Pipeline
#172439
canceled
2 years ago
Stage: startup
Stage: build
Stage: install_and_test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+55
-32
55 additions, 32 deletions
.gitlab-ci.yml
with
55 additions
and
32 deletions
.gitlab-ci.yml
+
55
−
32
View file @
c195d516
...
@@ -8,8 +8,20 @@ default:
...
@@ -8,8 +8,20 @@ default:
# Try to use only one job per stage.
# Try to use only one job per stage.
# Stupid GitLab fails to load the cache for second jobs.
# Stupid GitLab fails to load the cache for second jobs.
cache
:
# Global `cache`.
cache
:
# Global `cache`.
key
:
'
python-env'
paths
:
paths
:
-
g2p-env-$CI_PIPELINE_ID
-
g2p-env-$CI_PIPELINE_ID/
before_script
:
-
apt-get -qq update && apt-get -qq install -y gcc gfortran libblas-dev liblapack-dev
-
source g2p-env-$CI_PIPELINE_ID/bin/activate
-
pip list
-
ENV_PATH=$(python3 -c "import sysconfig; print(sysconfig.get_path('platlib'))")
#- ENV_PATH=$(python3 -m site --user-site)
-
LIBDIR=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
-
echo $ENV_PATH
-
echo $LIBDIR
-
ls
artifacts
:
artifacts
:
reports
:
reports
:
...
@@ -18,7 +30,7 @@ default:
...
@@ -18,7 +30,7 @@ default:
path
:
coverage.xml
path
:
coverage.xml
paths
:
paths
:
-
logs/execution.log
-
logs/execution.log
-
dist/
*
-
dist/
after_script
:
# Global `after_script`.
after_script
:
# Global `after_script`.
-
ls g2p-env-$CI_PIPELINE_ID
-
ls g2p-env-$CI_PIPELINE_ID
...
@@ -28,31 +40,56 @@ variables:
...
@@ -28,31 +40,56 @@ variables:
PIP_CACHE_DIR
:
"
$CI_PROJECT_DIR/.cache/pip"
PIP_CACHE_DIR
:
"
$CI_PROJECT_DIR/.cache/pip"
stages
:
stages
:
-
startup
-
build
-
install_and_test
-
install_and_test
-
release
-
release
# Changes (e.g. apt install, pip install) do not persist across different GitLab CI jobs.
# python virtual environment into cache
# => Consolidate everything in GitLab CI into a single job, because the design is dumb.
default_venv
:
# => Since we only have one job, and GitLab Pages requires the job to be called `pages` for it to work, we now call this job `pages`.
stage
:
startup
install_and_test
:
stage
:
install_and_test
rules
:
rules
:
-
if
:
$CI_COMMIT_TAG
-
if
:
$CI_COMMIT_TAG
when
:
never
when
:
never
-
if
:
$CI_COMMIT_REF_PROTECTED == "false" && $CI_PIPELINE_SOURCE == "push"
-
if
:
$CI_PIPELINE_SOURCE == "push"
before_script
:
# Overrides global `before_script`.
before_script
:
-
echo "Hello, $GITLAB_USER_LOGIN!"
-
uname -s
# get system info
-
python -V
# Print out python version for debugging.
-
uname -v
-
uname -m
-
uname -o
-
echo "Hello ${GITLAB_USER_NAME} !"
-
echo "This is job ${CI_JOB_ID}"
script
:
-
echo "Creating virtual environment..."
-
pip install -U virtualenv
-
python3 -m venv g2p-env-$CI_PIPELINE_ID
-
ls
-
pwd
-
pwd
# Install everything.
-
apt-get -qq update && apt-get -qq install -y gcc gfortran libblas-dev liblapack-dev libopenmpi-dev openmpi-bin
-
python -m venv g2p-env-$CI_PIPELINE_ID
-
source g2p-env-$CI_PIPELINE_ID/bin/activate
-
source g2p-env-$CI_PIPELINE_ID/bin/activate
-
python3 -m pip install --upgrade pip
-
pip install -U pip build pytest pytest-cov coverage twine
-
pip install -U pip build pytest pytest-cov coverage twine
-
pip list
# build on mpcdf server
default_build
:
stage
:
build
rules
:
-
if
:
$CI_COMMIT_TAG
when
:
never
-
if
:
$CI_PIPELINE_SOURCE == "push"
needs
:
[
'
default_venv'
]
script
:
-
python3 -m build
# build gvec_to_python (.whl)
install_and_test
:
stage
:
install_and_test
rules
:
-
if
:
$CI_COMMIT_TAG
when
:
never
-
if
:
$CI_COMMIT_REF_PROTECTED == "false" && $CI_PIPELINE_SOURCE == "push"
needs
:
[
'
default_build'
]
script
:
script
:
# Build: build python package, install package.
# install package
-
echo "Run python build:"
-
python -m build
-
ls -lah dist
-
ls -lah dist
-
echo "Install dist:"
-
echo "Install dist:"
-
pip install -U dist/gvec_to_python-*.whl --force-reinstall
-
pip install -U dist/gvec_to_python-*.whl --force-reinstall
...
@@ -77,7 +114,7 @@ deploy:
...
@@ -77,7 +114,7 @@ deploy:
-
if
:
$CI_COMMIT_TAG
-
if
:
$CI_COMMIT_TAG
when
:
never
when
:
never
-
if
:
$CI_COMMIT_REF_NAME == "master"
-
if
:
$CI_COMMIT_REF_NAME == "master"
needs
:
[
"
install_and_test
"
]
needs
:
[
"
default_build
"
]
script
:
script
:
-
twine upload dist/*
-
twine upload dist/*
...
@@ -119,18 +156,4 @@ release_job:
...
@@ -119,18 +156,4 @@ release_job:
url
:
'
https://pypi.org/project/gvec_to_python/'
url
:
'
https://pypi.org/project/gvec_to_python/'
# OLD, TO BE DELETED
# deploy:
# stage: release
# rules:
# - if: $CI_COMMIT_TAG
# when: never
# - if: $CI_COMMIT_REF_NAME == "master"
# before_script:
# - apt-get -qq update && apt-get -qq install -y gcc gfortran libblas-dev liblapack-dev libopenmpi-dev openmpi-bin
# - pip install -U pip build twine
# script:
# - python -m build
# - ls -lah dist
# - twine upload dist/*
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