-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Run tests and publish to PyPI.org | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
# Linting | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: psf/black@stable | ||
with: | ||
options: "--check --verbose --diff --color" | ||
|
||
ruff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: jpetrucciani/ruff-check@main | ||
|
||
# Tests | ||
api-tests: | ||
needs: [black, ruff] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup running platform stack | ||
run: docker compose up --build -d | ||
|
||
- name: Integration tests - API | ||
run: docker run | ||
--env CONF_DIR=/dp3/tests/test_config | ||
--network container:dp3_api | ||
dp3_interpreter python -m unittest discover -s tests/test_api -v | ||
|
||
- name: Teardown platform stack | ||
run: docker compose down | ||
|
||
unit-tests: | ||
needs: [black, ruff] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build Test | ||
run: docker build -f docker/python/Dockerfile --target base -t dp3_interpreter . | ||
|
||
- name: Test | ||
run: docker run dp3_interpreter python -m unittest discover -s tests/test_common | ||
|
||
# Publish to PyPI | ||
pypi: | ||
needs: [black, ruff, api-tests, unit-tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: python3 -m pip install --upgrade build && python3 -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |