Skip to content

Commit 54204fc

Browse files
committed
Added automatic publish workflow.
1 parent 8c0d39b commit 54204fc

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/release.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Run tests and publish to PyPI.org
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
# Linting
7+
black:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: psf/black@stable
12+
with:
13+
options: "--check --verbose --diff --color"
14+
15+
ruff:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: jpetrucciani/ruff-check@main
20+
21+
# Tests
22+
api-tests:
23+
needs: [black, ruff]
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Setup running platform stack
29+
run: docker compose up --build -d
30+
31+
- name: Integration tests - API
32+
run: docker run
33+
--env CONF_DIR=/dp3/tests/test_config
34+
--network container:dp3_api
35+
dp3_interpreter python -m unittest discover -s tests/test_api -v
36+
37+
- name: Teardown platform stack
38+
run: docker compose down
39+
40+
unit-tests:
41+
needs: [black, ruff]
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
46+
- name: Build Test
47+
run: docker build -f docker/python/Dockerfile --target base -t dp3_interpreter .
48+
49+
- name: Test
50+
run: docker run dp3_interpreter python -m unittest discover -s tests/test_common
51+
52+
# Publish to PyPI
53+
pypi:
54+
needs: [black, ruff, api-tests, unit-tests]
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v3
59+
with:
60+
fetch-depth: 0
61+
- run: python3 -m pip install --upgrade build && python3 -m build
62+
- name: Publish package
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)