Skip to content

Commit

Permalink
Merge branch 'replace-cache-with-artifacts' into 'master'
Browse files Browse the repository at this point in the history
Replace cache with artifacts

See merge request ShellLogger/ShellLogger!10
  • Loading branch information
jmgate committed Sep 22, 2021
2 parents 3a5a282 + ca23236 commit 084f474
Showing 1 changed file with 13 additions and 41 deletions.
54 changes: 13 additions & 41 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
# https://docs.gitlab.com/ee/ci/yaml/.


# Set up a global cache to pass information across stages.
cache: &global_cache
key: "${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
paths:
- doc/html/
- tests/htmlcov/
- venv-clean-python/
policy: pull-push


# Set up the pipeline stages.
stages:
- prepare
Expand All @@ -31,10 +21,10 @@ before_script:
${LSB_RELEASE} -a
fi
- |-
if [ -d "venv-clean-python" ]; then
source venv-clean-python/bin/activate
if [ -d "shelllogger-venv" ]; then
source shelllogger-venv/bin/activate
else
echo "Virtual Environment 'venv-clean-python' was not found"
echo "Virtual Environment 'shelllogger-venv' was not found"
exit 1
fi
echo "-----"
Expand All @@ -55,20 +45,16 @@ after_script:
#-----------------------------------------------------------------------


# Create the virtual environment, install the requirements, and save the
# environment to the cache.
# Create the virtual environment and install the requirements.
install requirements:
stage: prepare
timeout: 10m
before_script:
- python3 -m venv venv-clean-python
cache:
<<: *global_cache
when: on_success
- python3 -m venv shelllogger-venv
script:

# Activate the virtual environment.
- source venv-clean-python/bin/activate
- source shelllogger-venv/bin/activate

# Ensure `pip` is up-to-date.
- python3 -m pip install --upgrade pip
Expand All @@ -81,6 +67,9 @@ install requirements:
-r requirements.txt
-r tests/requirements.txt
-r doc/requirements.txt
artifacts:
paths:
- shelllogger-venv


#-----------------------------------------------------------------------
Expand All @@ -93,13 +82,9 @@ build distribution:
stage: install
needs: ["install requirements"]
timeout: 5m
cache:
<<: *global_cache
policy: pull
script:
- python3 -m pip wheel --no-deps -w dist .
artifacts:
name: "shelllogger-dist"
paths:
- dist/shelllogger*.whl
expire_in: 6 weeks
Expand All @@ -110,10 +95,11 @@ install package:
stage: install
needs: ["install requirements"]
timeout: 5m
cache:
<<: *global_cache
script:
- python3 -m pip install .
artifacts:
paths:
- shelllogger-venv


#-----------------------------------------------------------------------
Expand All @@ -126,8 +112,6 @@ pytest:
stage: test
needs: ["install requirements"]
timeout: 5m
cache:
<<: *global_cache
script:
- python3 -m pytest
--cov=src.shelllogger
Expand All @@ -151,21 +135,16 @@ flake8:
stage: test
needs: ["install requirements"]
timeout: 5m
cache:
<<: *global_cache
script:
- python3 -m flake8
--exclude=venv-clean-python
--exclude=shelllogger-venv


# Ensure the examples run without problems.
examples:
stage: test
needs: ["install requirements", "install package"]
timeout: 5m
cache:
<<: *global_cache
policy: pull
script:
- cd examples
- python3 -m pip list
Expand All @@ -188,8 +167,6 @@ sphinx:
stage: documentation
needs: ["install requirements", "install package"]
timeout: 5m
cache:
<<: *global_cache
script:
- cd doc
- bash make_html_docs.sh
Expand All @@ -208,9 +185,6 @@ pages:
stage: deploy
needs: ["pytest", "sphinx"]
timeout: 5m
cache:
<<: *global_cache
policy: pull
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
script:
Expand All @@ -231,7 +205,5 @@ pages:
uninstall package:
stage: finish
timeout: 5m
cache:
<<: *global_cache
script:
- python3 -m pip uninstall -y shelllogger

0 comments on commit 084f474

Please sign in to comment.