-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
88 lines (76 loc) · 1.7 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
variables:
DJANGO_SETTINGS_MODULE: "project.settings"
ACTIVITYPUB_TOOLKIT_DATABASE_PASSWORD: "activitypub_toolkit_ci"
PYTEST_ADDOPTS: "--disable-socket --allow-hosts=postgres"
stages:
- build_docs
- publish_docs
- test
- build
- release
build_site:
image: python:3.12
before_script:
- pip install poetry
- poetry install --only docs
stage: build_docs
script:
- poetry run mkdocs build
artifacts:
paths:
- site
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
changes:
- docs/*
- mkdocs.yml
pages:
stage: publish_docs
image: python:3.12
script:
- mv site public
artifacts:
paths:
- public
needs:
- build_site
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
changes:
- docs/*
- mkdocs.yml
allow_failure: true
test:
stage: test
image: python:3.12
services:
- postgres:latest
variables:
POSTGRES_DB: activitypub_toolkit
POSTGRES_USER: activitypub_toolkit
POSTGRES_PASSWORD: "$ACTIVITYPUB_TOOLKIT_DATABASE_PASSWORD"
script:
- export
- pip install poetry
- poetry install
- poetry run pytest
rules:
- changes:
- activitypub/*
- pyproject.toml
- poetry.lock
publish_python_package:
image: python:3.12
stage: build
script:
- apt-get update && apt-get install -y jq
- pip install poetry id
- oidc_token=$(python -m id PYPI)
- resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\":\"${oidc_token}\"}")
- api_token=$(jq --raw-output '.token' <<< "${resp}")
- poetry config pypi-token.pypi ${api_token}
- poetry publish --build
id_tokens:
PYPI_ID_TOKEN:
aud: pypi
when: manual