Fix readme #13
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: build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [created] | |
jobs: | |
quality: | |
name: Lint | |
runs-on: ubuntu-latest | |
container: | |
image: python:3.9-slim | |
steps: | |
- uses: actions/checkout@v2 | |
- run: pip install black flake8 Flake8-pyproject pyupgrade isort mypy | |
- run: isort climetlab_maelstrom_power_production tests | |
- run: | | |
pyupgrade \ | |
--py3-plus \ | |
--py36-plus \ | |
--py37-plus \ | |
--py38-plus \ | |
--py39-plus \ | |
$(find climetlab_maelstrom_power_production tests | grep "\.py$") | |
- run: black --config pyproject.toml climetlab_maelstrom_power_production tests | |
- run: flake8 --config pyproject.toml climetlab_maelstrom_power_production tests | |
- run: mypy --config-file pyproject.toml climetlab_maelstrom_power_production | |
checks: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ["ubuntu-latest"] | |
python-version: ["3.7"] | |
#platform: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
#python-version: ["3.6", "3.7", "3.8", "3.9"] | |
name: Test | |
runs-on: ubuntu-latest | |
container: | |
image: fabianemmi/python-poetry:3.9-1.5.1 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install package | |
run: poetry install --with ci-tests --with notebooks | |
- name: Run tests | |
run: | | |
poetry run pytest tests \ | |
--cov=climetlab_maelstrom_power_production --cov-report term --cov-report html \ | |
--suppress-no-test-exit-code \ | |
--junitxml=./report/pytest.xml | |
- name: Run notebooks utils tests | |
run: | | |
poetry run pytest notebooks/utils | |
deploy: | |
if: ${{ github.event_name == 'release' }} | |
name: Upload to pypi | |
needs: checks | |
runs-on: ubuntu-latest | |
container: | |
image: fabianemmi/python-poetry:3.9-1.5.1 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check version | |
run: | | |
export RELEASE=${GITHUB_REF##*/} | |
poetry version $RELEASE | |
export VERSION=$(poetry version -s) | |
echo $RELEASE | |
echo $VERSION | |
test $RELEASE = $VERSION | |
- name: Install dependencies | |
run: poetry install --no-dev | |
- name: Build and publish | |
env: | |
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
poetry publish --build \ | |
--username $PYPI_USERNAME \ | |
--password $PYPI_PASSWORD |