Skip to content

Commit

Permalink
Add base image for gitlab runner to speed up tests (#458)
Browse files Browse the repository at this point in the history
* Add base image for gitlab runner to speed up tests

* Only install dependencies

---------

Co-authored-by: Jan Makovecki <[email protected]>
  • Loading branch information
jmakovecki and Jan Makovecki committed May 5, 2023
1 parent fdb275c commit fdd8333
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
23 changes: 17 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
image: python:3.9

stages:
- update
- test

update_base_image:
stage: update
image: docker:latest
rules:
- if: '$UPDATE_BASE_IMAGE == "true"'
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
- docker build --file=".gitlab/docker/Dockerfile" --tag="$BASE_IMAGE" .
- docker push "$BASE_IMAGE"

run_sh_integration_tests:
stage: test
when: always
before_script:
- apt-get update
- apt-get install -y build-essential libgdal-dev proj-bin gcc libproj-dev libspatialindex-dev libopenjp2-7
image: "$BASE_IMAGE"
dependencies: [ ]
needs: [ ]
rules:
- when: always
if: '$UPDATE_BASE_IMAGE != "true"'
script:
- pip install -e .[AWS,DEV]
- pytest -m "sh_integration"
9 changes: 9 additions & 0 deletions .gitlab/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.9

COPY . /sentinelhub-py
RUN cd sentinelhub-py && \
python -m pip install pip-tools && \
python -m piptools compile -o requirements.txt pyproject.toml --extra dev --extra aws && \
python -m pip install -r requirements.txt && \
python -m pip uninstall pip-tools && \
rm -r /sentinelhub-py

0 comments on commit fdd8333

Please sign in to comment.