Repository navigation
133 lines (122 loc) · 4.92 KB
/
Copy pathpython-publish.yml
File metadata and controls
133 lines (122 loc) · 4.92 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#This GitHub workflow is only needed for python package releases which are supposed to be published on pypi.
#DOES NOT PUBLISH YET
#This workflows will upload a Python Package using Twine when a release is created
#For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [created, edited]
jobs:
tests:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.11"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.3.2
with:
python-version: ${{ matrix.python-version }}
# integrationtests
- name: Install Dependencies (integrationtests)
run: uv sync --group tests --group init_bo4e
- name: Set up test database
run: |
cd src
uv run python -m borm.db.postgresql_db.create_env_file
docker compose -f borm/db/postgresql_db/docker-compose.yaml up -d
- name: Pull and generate BO4E models (integrationtests)
run: |
mkdir -p bo4e_schemas
cd bo4e_schemas
uv run bost -t v202401.0.1 -o ./
uv run bo4e-generator -i ./ -o ../src/borm/models -ot sql_model
- name: Run the Integration Tests
run: |
uv run python -m borm
uv run pytest
- name: Tear down test database (integrationtests)
run: docker compose -f src/borm/db/postgresql_db/docker-compose.yaml down -v
# unittests
- name: Set up test database (unittests)
run: |
cd src
uv run python -m borm.db.postgresql_db.create_env_file
docker compose -f borm/db/postgresql_db/docker-compose.yaml up -d
- name: Tear down test database (unittests)
run: docker compose -f src/borm/db/postgresql_db/docker-compose.yaml down -v
# linting
- name: Install Dependencies (linting)
run: uv sync --group linting --group init_bo4e
- name: Pull and generate BO4E models (linting)
run: |
mkdir -p bo4e_schemas
cd bo4e_schemas
uv run bost -t v202401.0.1 -o ./
uv run bo4e-generator -i ./ -o ../src/borm/models -ot sql_model
- name: Run ruff check
run: |
uv run ruff check src/borm tests
# coverage
- name: Install Dependencies (coverage)
run: uv sync --group coverage --group tests --group init_bo4e
- name: Set up test database (coverage)
run: |
cd src
uv run python -m borm.db.postgresql_db.create_env_file
docker compose -f borm/db/postgresql_db/docker-compose.yaml up -d
- name: Pull and generate BO4E models (coverage)
run: |
mkdir -p bo4e_schemas
cd bo4e_schemas
uv run bost -t v202401.0.1 -o ./
uv run bo4e-generator -i ./ -o ../src/borm/models -ot sql_model
- name: Run Tests and Record Coverage
run: |
cd tests
uv run python -m borm
uv run coverage run -m pytest
uv run coverage html --omit tests/*,src/borm/models/*
uv run coverage report --fail-under 80 --omit tests/*,src/borm/models/*
- name: Tear down test database (coverage)
run: docker compose -f src/borm/db/postgresql_db/docker-compose.yaml down -v
# type_check
- name: Install Dependencies (type_check)
run: uv sync --group type_check --group init_bo4e
- name: Pull and generate BO4E models (type_check)
run: |
mkdir -p bo4e_schemas
cd bo4e_schemas
uv run bost -t v202401.0.1 -o ./
uv run bo4e-generator -i ./ -o ../src/borm/models -ot sql_model
- name: Run mypy
run: |
uv run mypy --show-error-codes tests
uv run mypy --show-error-codes src/borm
# spell_check
- name: Install Dependencies (spell_check)
run: uv sync --group spell_check
- name: Run codespell
run: |
uv run codespell --ignore-words=domain-specific-terms.txt src/
uv run codespell --ignore-words=domain-specific-terms.txt README.md
# build-n-publish:
# name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
# runs-on: ubuntu-latest
# needs: tests
# steps:
# - uses: actions/checkout@v2
# - name: Install uv
# uses: astral-sh/setup-uv@v10.3.2
# - name: Build a binary wheel and a source tarball
# run: |
# uv build
# - name: Publish distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags/v')
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}