-
Jakob Moser authoredJakob Moser authored
.gitlab-ci.yml 2.88 KiB
stages:
- test
- deploy
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
lint-openapi:
image:
name: redocly/cli
entrypoint: [""]
stage: test
script: openapi lint portal/static/docs/api/v0/openapi-spec.yaml
allow_failure: true
test-frontend:
image: python:3.12
stage: test
before_script:
- apt-get update
- apt-get install -y ca-certificates curl gnupg faketime
- mkdir -p /etc/apt/keyrings
- curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
- echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
- apt-get update
- apt-get install -y nodejs libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- pip install --upgrade pip setuptools
- pip install pipenv
- pipenv requirements > requirements.txt
- pip uninstall --yes pipenv
- pip install -r requirements.txt
- npm install cypress
script:
- mkdir instance
- cp tests/resources/portal.test.db instance/portal.db
- export FLASK_APP=portal
- faketime '2024-09-26 13:37:00' flask run &
- faketime '2024-09-26 13:37:00' npx cypress run
artifacts:
when: always
paths:
- cypress/videos
- cypress/screenshots
expire_in: 1 week
test-python:
image: python:3.12
stage: test
cache:
paths:
- .cache/pip
before_script:
- pip install pipenv
- pipenv requirements --dev > requirements.txt
- pip install -r requirements.txt
script:
- black --check $CI_PROJECT_DIR
- mypy .
# This snippet is copied and modified from the GitLab Documentation (as of 2021-01-10, the contents of the script seem to have changed by now)
# * Title of the documentation page: "Building a Docker image with kaniko"
# * Author: (c) 2011-present GitLab B.V.
# * URL: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html#building-a-docker-image-with-kaniko
# * License: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0)
build-docker:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: deploy
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- echo "{\"commit\":\"$CI_COMMIT_SHA\",\"datetime\":\"$CI_COMMIT_TIMESTAMP\"}" > PORTAL_VERSION
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
only:
- master
# End of adapted snippet