1.2.1-beta.1 #177
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: CI | |
on: | |
push: | |
branches: [ master, develop ] | |
pull_request: | |
branches: [ master, develop ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10"] | |
steps: | |
- name: workaround | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: '0' | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '${{ matrix.python-version }}' | |
- name: Install poetry | |
uses: Gr1N/setup-poetry@v7 | |
# with: | |
# virtualenvs-create: true | |
# virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: poetry-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: install | |
run: make install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: test | |
run: poetry run make test | |
#from https://mestrak.com/blog/semantic-release-with-python-poetry-github-actions-20nn | |
badge-n-release: | |
needs: test | |
if: github.event_name == 'push' | |
env: | |
PYTHON_VERSION: 3.8 | |
runs-on: ubuntu-latest | |
steps: | |
- name: workaround | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: '0' | |
- name: Install poetry | |
uses: Gr1N/setup-poetry@v7 | |
# with: | |
# virtualenvs-create: false | |
# virtualenvs-in-project: false | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: poetry-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }} | |
- name: install | |
run: make install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: badges | |
run: poetry run make clean badges | |
- name: commit reports and badges | |
uses: EndBug/add-and-commit@v9 # You can change this to use a specific version. | |
with: | |
add: docs/reports | |
- name: publish release | |
if: github.ref == 'refs/heads/develop' && contains(github.event.head_commit.message, 'chore(trigger-release)') | |
uses: relekang/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
repository_username: __token__ | |
repository_password: ${{ secrets.PYPI_TOKEN }} | |
- name: Login to Docker Hub | |
if: github.ref == 'refs/heads/develop' && (contains(github.event.head_commit.message, 'chore(trigger-release)') || contains(github.event.head_commit.message, 'chore(trigger-docker)')) | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: push docker images | |
if: github.ref == 'refs/heads/develop' && (contains(github.event.head_commit.message, 'chore(trigger-release)') || contains(github.event.head_commit.message, 'chore(trigger-docker)')) | |
# workaround, issues wit poetry / virtualenv? -> semanti-release not found | |
run: make docker-push | |
# - name: publish prerelease | |
# if: github.event_name == 'pull_request' && github.base_ref == 'master' | |
# uses: relekang/python-semantic-release@master | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# additional_options: --prerelease |