Skip to content
Snippets Groups Projects

ci: improve pipeline

Merged jooola requested to merge (removed):ci_base_images into main
+ 54
43
---
include:
- project: funkwhale/ci
file: /templates/pre-commit.yml
workflow:
rules:
# Run for any event on the default branch in the funkwhale namespace
- if: >
$CI_PROJECT_NAMESPACE == "funkwhale" &&
$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# Run for merge requests
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
stages:
- lint
- test
- build
variables:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: funkwhale_network
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
pre-commit:
stage: lint
image: python:3.11
extends: [.pre-commit]
tests:
stage: test
allow_failure: true
image: $CI_REGISTRY/funkwhale/ci/python:3.9
services:
- name: timescale/timescaledb:latest-pg11
alias: db
variables:
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
PRE_COMMIT_HOME: $CI_PROJECT_DIR/.cache/pre-commit
cache:
paths:
- $PIP_CACHE_DIR
- $PRE_COMMIT_HOME
POSTGRES_PASSWORD: postgres
POSTGRES_DB: funkwhale_network
DB_DSN: user=postgres password=postgres dbname=funkwhale_network host=db
before_script:
- pip3 install pre-commit
- |
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libpq-dev
- poetry install
script:
- pre-commit run --verbose --all --color=always --show-diff-on-failure
#tests:
# stage: test
# services:
# - name: timescale/timescaledb:latest-pg11
# alias: db
# image: python:3.9-alpine3.15
# before_script:
# - apk add python3-dev build-base curl libpq-dev
# - curl -sSL https://install.python-poetry.org | python3 -
# - export PATH="/root/.local/bin:$PATH"
# - poetry install
# script:
# - poetry run pytest --cov-report xml --cov-report term-missing:skip-covered --cov=funkwhale_network --junitxml=report.xml tests/
# variables:
# DB_DSN: user=postgres password=postgres dbname=funkwhale_network host=db
# artifacts:
# expire_in: 2 weeks
# reports:
# junit: report.xml
# coverage_report:
# coverage_format: cobertura
# path: coverage.xml
- >
poetry run pytest
--cov=funkwhale_network
--cov-report=xml
--cov-report=term-missing:skip-covered
--junitxml=report.xml
tests/
artifacts:
expire_in: 2 weeks
reports:
junit: report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
build:
only:
- main
stage: build
image: egon0/docker-with-buildx-and-git:bash
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
tags:
- dind
image: egon0/docker-with-buildx-and-git:bash
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- docker:20-dind
before_script:
Loading