Fix CI #71
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: | |
jobs: | |
build-wheel: | |
name: "🏗️ Python wheel" | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
# - macos-latest | |
# - windows-latest | |
python: | |
- 3.7 | |
- 3.9 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "📥 Check-out" | |
uses: actions/checkout@v2 | |
- name: "🧰 Install Python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: "🧰 Install dependencies" | |
run: | | |
python -m pip install --upgrade pip build twine | |
pip install -e . | |
- name: "🏗️ Build Python wheel" | |
run: python -m build | |
- name: "🧪 Check package bundles" | |
run: twine check dist/* | |
code-format: | |
name: "🔍 Python code format" | |
needs: | |
- build-wheel | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python: | |
- 3.7 | |
- 3.9 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "📥 Check-out" | |
uses: actions/checkout@v2 | |
- name: "🧰 Install Python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: "🧰 Install dependencies" | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e . | |
pip install -e .[test] | |
- name: "🔍 Check Python code format" | |
run: flake8 chatnoir_api examples tests | |
lint: | |
name: "🔍 Python Lint" | |
needs: | |
- build-wheel | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python: | |
- 3.7 | |
- 3.9 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "📥 Check-out" | |
uses: actions/checkout@v2 | |
- name: "🧰 Install Python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: "🧰 Install dependencies" | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e . | |
pip install -e .[test] | |
- name: "🔍 Lint Python code" | |
run: pylint -E chatnoir_api examples tests | |
unit-tests: | |
name: "🧪 Python unit tests" | |
needs: | |
- build-wheel | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python: | |
- 3.7 | |
- 3.9 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "📥 Check-out" | |
uses: actions/checkout@v2 | |
- name: "🧰 Install Python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: "🧰 Install dependencies" | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e . | |
pip install -e .[test] | |
- name: "🧪 Test Python code" | |
env: | |
CHATNOIR_API_KEY: ${{ secrets.CHATNOIR_API_KEY }} | |
CHATNOIR_API_KEY_STAGING: ${{ secrets.CHATNOIR_API_KEY_STAGING }} | |
CHATNOIR_API_KEY_CHAT: ${{ secrets.CHATNOIR_API_KEY_CHAT }} | |
run: pytest chatnoir_api examples tests --cov --cov-report=term --cov-report=xml | |
- name: "📤 Upload test coverage" | |
uses: actions/upload-artifact@v2 | |
with: | |
path: coverage.xml | |
name: Python test coverage | |
- name: "📤 Publish test coverage" | |
uses: codecov/codecov-action@v1 | |
publish: | |
name: "🚀 Publish Python package" | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: | |
- code-format | |
- lint | |
- unit-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: "📥 Check-out" | |
uses: actions/checkout@v2 | |
- name: "🧰 Install Python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: "🧰 Install dependencies" | |
run: | | |
python -m pip install --upgrade pip build | |
pip install -e . | |
- name: "🏗️ Build Python wheel" | |
run: python -m build | |
- name: "🚀 Publish Python package" | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
release: | |
name: "🚀 Create GitHub release" | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: | |
- code-format | |
- lint | |
- unit-tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: "📥 Check-out" | |
uses: actions/checkout@v2 | |
- name: "🏷️ Get version tag" | |
id: get-version | |
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//} | |
- name: "🧰 Install Python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: "🧰 Install dependencies" | |
run: | | |
python -m pip install --upgrade pip build | |
pip install -e . | |
- name: "🏗️ Build Python wheel" | |
run: python -m build | |
- name: "🚀 Create GitHub release" | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Release ${{ steps.get-version.outputs.tag }} | |
files: dist/* | |
fail_on_unmatched_files: true | |
draft: false | |
prerelease: false | |
generate_release_notes: true |