-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
119 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,119 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
run-unit-tests: | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
run: | | ||
rm -rf $HOME/.poetry/bin/poetry | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
poetry --version | ||
- name: Install dependencies | ||
run: | | ||
poetry install --no-interaction --no-ansi --no-root | ||
- name: Run Unit Tests | ||
run: | | ||
mkdir test-results | ||
poetry run python -m pytest --junitxml=test-results/junit.xml -v tests | ||
- name: Upload test results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results | ||
path: test-results | ||
|
||
verify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Verify | ||
run: | | ||
./verify.sh | ||
publish-to-test-pypi: | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install Poetry | ||
run: | | ||
rm -rf $HOME/.poetry/bin/poetry | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
poetry --version | ||
- name: Install dependencies | ||
run: | | ||
poetry install --no-interaction --no-ansi --no-root | ||
- name: Build package | ||
run: | | ||
poetry build | ||
- name: Publish to Test PyPI | ||
env: | ||
PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }} | ||
run: | | ||
poetry config repositories.testpypi https://test.pypi.org/legacy/ | ||
poetry publish -u __token__ -p $PYPI_TEST_TOKEN -r testpypi | ||
publish-to-pypi: | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install Poetry | ||
run: | | ||
rm -rf $HOME/.poetry/bin/poetry | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
poetry --version | ||
- name: Install dependencies | ||
run: | | ||
poetry install --no-interaction --no-ansi --no-root | ||
- name: Build package | ||
run: | | ||
poetry build | ||
- name: Publish to PyPI | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
poetry publish -u __token__ -p $PYPI_TOKEN |