Add woodpecker CI configuration
This commit is contained in:
parent
bf43603d65
commit
aff565862c
9 changed files with 64 additions and 94 deletions
|
|
@ -1,29 +0,0 @@
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- lint
|
|
||||||
- release
|
|
||||||
|
|
||||||
variables:
|
|
||||||
UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"
|
|
||||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
||||||
DJANGO_SETTINGS_MODULE: "newsreader.conf.gitlab"
|
|
||||||
POSTGRES_HOST: "$POSTGRES_HOST"
|
|
||||||
POSTGRES_DB: "$POSTGRES_NAME"
|
|
||||||
POSTGRES_NAME: "$POSTGRES_NAME"
|
|
||||||
POSTGRES_USER: "$POSTGRES_USER"
|
|
||||||
POSTGRES_PASSWORD: "$POSTGRES_PASSWORD"
|
|
||||||
|
|
||||||
cache:
|
|
||||||
key: "$CI_COMMIT_REF_SLUG"
|
|
||||||
paths:
|
|
||||||
- .cache/pip
|
|
||||||
- .cache/uv
|
|
||||||
- node_modules/
|
|
||||||
- .venv/
|
|
||||||
|
|
||||||
include:
|
|
||||||
- local: '/gitlab-ci/build.yml'
|
|
||||||
- local: '/gitlab-ci/test.yml'
|
|
||||||
- local: '/gitlab-ci/lint.yml'
|
|
||||||
- local: '/gitlab-ci/release.yml'
|
|
||||||
8
.woodpecker/build.yaml
Normal file
8
.woodpecker/build.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- image: node:lts
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- npm run build
|
||||||
19
.woodpecker/lint.yaml
Normal file
19
.woodpecker/lint.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: main
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: python linting
|
||||||
|
image: python:3.11
|
||||||
|
commands:
|
||||||
|
- pip install uv
|
||||||
|
- uv sync --extra testing --extra ci
|
||||||
|
- ./.venv/bin/ruff check src/
|
||||||
|
- ./.venv/bin/ruff format --check src/
|
||||||
|
|
||||||
|
- name: javascript linting
|
||||||
|
image: node:lts
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- npm run lint
|
||||||
36
.woodpecker/tests.yaml
Normal file
36
.woodpecker/tests.yaml
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: postgres
|
||||||
|
image: postgres:15
|
||||||
|
environment:
|
||||||
|
POSTGRES_NAME: newsreader
|
||||||
|
POSTGRES_USER: newsreader
|
||||||
|
POSTGRES_PASSWORD: sekrit
|
||||||
|
- name: memcached
|
||||||
|
image: memcached:1.5.22
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: python tests
|
||||||
|
image: python:3.11
|
||||||
|
environment:
|
||||||
|
DJANGO_SETTINGS_MODULE: "newsreader.conf.ci"
|
||||||
|
DJANGO_SECRET_KEY: sekrit
|
||||||
|
POSTGRES_HOST: postgres
|
||||||
|
POSTGRES_PORT: 5432
|
||||||
|
POSTGRES_DB: newsreader
|
||||||
|
POSTGRES_NAME: newsreader
|
||||||
|
POSTGRES_USER: newsreader
|
||||||
|
POSTGRES_PASSWORD: sekrit
|
||||||
|
commands:
|
||||||
|
- pip install uv
|
||||||
|
- uv sync --extra testing --extra ci
|
||||||
|
- ./.venv/bin/coverage run ./src/manage.py test newsreader
|
||||||
|
- ./.venv/bin/coverage report --show-missing
|
||||||
|
|
||||||
|
- name: javascript tests
|
||||||
|
image: node:lts
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- npm test
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
static:
|
|
||||||
stage: build
|
|
||||||
image: node:lts
|
|
||||||
before_script:
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm run build
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
python-linting:
|
|
||||||
stage: lint
|
|
||||||
image: python:3.11
|
|
||||||
before_script:
|
|
||||||
- pip install uv
|
|
||||||
- uv sync --extra testing --extra ci
|
|
||||||
script:
|
|
||||||
- ./.venv/bin/ruff check src/
|
|
||||||
- ./.venv/bin/ruff format --check src/
|
|
||||||
only:
|
|
||||||
refs:
|
|
||||||
- main
|
|
||||||
- merge_requests
|
|
||||||
|
|
||||||
javascript-linting:
|
|
||||||
stage: lint
|
|
||||||
image: node:lts
|
|
||||||
before_script:
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm run lint
|
|
||||||
only:
|
|
||||||
refs:
|
|
||||||
- main
|
|
||||||
- merge_requests
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
script:
|
|
||||||
- echo 'running release job'
|
|
||||||
release:
|
|
||||||
name: 'Release $CI_COMMIT_TAG'
|
|
||||||
description: './CHANGELOG.md'
|
|
||||||
tag_name: '$CI_COMMIT_TAG'
|
|
||||||
ref: '$CI_COMMIT_TAG'
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
python-tests:
|
|
||||||
stage: test
|
|
||||||
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
|
|
||||||
services:
|
|
||||||
- postgres:15
|
|
||||||
- memcached:1.5.22
|
|
||||||
image: python:3.11
|
|
||||||
before_script:
|
|
||||||
- pip install uv
|
|
||||||
- uv sync --extra testing --extra ci
|
|
||||||
script:
|
|
||||||
- ./.venv/bin/coverage run ./src/manage.py test newsreader
|
|
||||||
|
|
||||||
javascript-tests:
|
|
||||||
stage: test
|
|
||||||
image: node:lts
|
|
||||||
before_script:
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm test
|
|
||||||
|
|
@ -33,7 +33,7 @@ CACHES = {
|
||||||
|
|
||||||
# Project settings
|
# Project settings
|
||||||
VERSION = get_current_version()
|
VERSION = get_current_version()
|
||||||
ENVIRONMENT = "gitlab"
|
ENVIRONMENT = "ci"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Optionally use sentry integration
|
# Optionally use sentry integration
|
||||||
Loading…
Add table
Add a link
Reference in a new issue