Merge pull request #38 from SimeonEhrig/covBatch #108
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
name: test-different-python-versions | |
on: [push, pull_request] | |
jobs: | |
formatter: | |
name: runner black code formatter | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: rickstaa/action-black@v1 | |
with: | |
black_args: ". --check" | |
run-job-generator: | |
runs-on: ubuntu-latest | |
needs: formatter | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
name: Check job generator example with Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install package | |
run: python setup.py install | |
- name: run unit tests | |
run: cd tests && python -m unittest && cd .. | |
- name: run integration test | |
run: python example/example.py --verify 3.0 && cat jobs.yml | |
check-version: | |
if: github.ref != 'refs/heads/main' | |
runs-on: ubuntu-latest | |
name: checks if the version.txt is different compare to the main branch | |
needs: run-job-generator | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pr | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
path: main | |
- name: check version.txt | |
run: | | |
if ! diff pr/version.txt main/version.txt >> /dev/null ; then | |
echo "the versions are different" | |
exit 0 | |
else | |
echo "the same version as in the main branch" | |
exit 1 | |
fi | |
build-package: | |
runs-on: ubuntu-latest | |
name: Build pip package and upload it | |
needs: run-job-generator | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.8' | |
architecture: x64 | |
- name: install requirements | |
run: | | |
python -m pip install --upgrade pip | |
python3 -m pip install --upgrade build | |
python3 -m pip install --upgrade twine | |
- name: Build pip package | |
run: python3 -m build | |
- run: ls dist | |
- name: publish a package to pypi.org | |
if: github.ref == 'refs/heads/main' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |