Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💚 Migrate CI from travis to gh-actions #29

Merged
merged 11 commits into from
Nov 4, 2021
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
application-import-names = aiopvpc
application-import-names = aiopvpc,tests
import-order-style = smarkets
inline-quotes = double
max-complexity = 10
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on:
pull_request:
push:
branches: [master]

jobs:
test-and-publish-flow:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Run Poetry image
uses: abatilo/[email protected]
with:
poetry-version: 1.1.11

- name: Install library
run: poetry install --no-interaction

- name: Run tests
run: poetry run pytest

# upload coverage only on master branch
- name: Upload coverage
if: ${{ github.ref == 'refs/heads/master' }}
uses: codecov/codecov-action@v2

# publish version only when pyproject.toml is changed in master
- name: Filter changes in pyproject
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
root:
- 'pyproject.toml'

- if: ${{ (github.ref == 'refs/heads/master') && (steps.changes.outputs.root == 'true')}}
name: Build and publish
env:
PYPI_USER: ${{ secrets.PYPI_USER }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry publish --username $PYPI_USER --password $PYPI_PASSWORD --build
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
minimum_pre_commit_version: "2.10.0"
repos:
- repo: https://github.com/pycqa/isort
rev: 5.8.0
hooks:
- id: isort
name: isort (python)
args:
- --dont-order-by-type
- repo: https://github.com/psf/black
rev: "21.6b0"
hooks:
Expand All @@ -10,6 +17,9 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-json
- id: check-toml
- id: check-yaml
- repo: https://github.com/pycqa/flake8
rev: "3.9.2"
hooks:
Expand All @@ -27,10 +37,21 @@ repos:
- flake8-quotes>=3.2.0
- flake8-string-format>=0.3.0
- flake8-tidy-imports>=4.2.1
- flake8-variables-names>=0.0.3
- pep8-naming>=0.11.1
- repo: "https://github.com/pre-commit/mirrors-mypy"
rev: "v0.902"
hooks:
- id: "mypy"
name: "Check type hints (mypy)"
verbose: true
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: monthly
skip: []
submodules: false
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Changelog

## [v2.2.1](https://github.com/azogue/aiopvpc/tree/v2.2.1) - Dependency update (2021-11-03)
## [v2.2.2](https://github.com/azogue/aiopvpc/tree/v2.2.2) - Migrate CI from travis to gh-actions (2021-11-04)

[Full Changelog](https://github.com/azogue/aiopvpc/compare/v2.2.2...v2.2.1)

**Changes:**

* :art: Add isort to pre-commit config
* :green_heart: Add configuration for pre-commit.ci to run linter checks there
* :green_heart: CI flow with GitHub Actions to
- install library with `poetry`
- run tests
- upload coverage when merging to master
- publish a new pypi version when merging to master if `pyproject.toml` changes
* :fire: Remove previus travis CI config

## [v2.2.1](https://github.com/azogue/aiopvpc/tree/v2.2.1) - Quickfix for 403 status code from ESIOS API (2021-11-03)

[Full Changelog](https://github.com/azogue/aiopvpc/compare/v2.2.1...v2.2.0)

Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
[![PyPi](https://pypip.in/v/aiopvpc/badge.svg)](https://pypi.org/project/aiopvpc/)
[![Wheel](https://pypip.in/wheel/aiopvpc/badge.svg)](https://pypi.org/project/aiopvpc/)
[![Travis Status](https://travis-ci.org/azogue/aiopvpc.svg?branch=master)](https://travis-ci.org/azogue/aiopvpc)
[![codecov](https://codecov.io/gh/azogue/aiopvpc/branch/master/graph/badge.svg)](https://codecov.io/gh/azogue/aiopvpc)
[![PyPI Version][pypi-image]][pypi-url]
[![pre-commit.ci Status][pre-commit-ci-image]][pre-commit-ci-url]
[![Build Status][build-image]][build-url]
[![Code Coverage][coverage-image]][coverage-url]
<!-- Badges -->
[pypi-image]: https://img.shields.io/pypi/v/aiopvpc
[pypi-url]: https://pypi.org/project/aiopvpc/
[pre-commit-ci-image]: https://results.pre-commit.ci/badge/github/azogue/aiopvpc/master.svg
[pre-commit-ci-url]: https://results.pre-commit.ci/latest/github/azogue/aiopvpc/master
[build-image]: https://github.com/azogue/aiopvpc/actions/workflows/main.yml/badge.svg
[build-url]: https://github.com/azogue/aiopvpc/actions/workflows/main.yml
[coverage-image]: https://codecov.io/gh/azogue/aiopvpc/branch/master/graph/badge.svg
[coverage-url]: https://codecov.io/gh/azogue/aiopvpc

# aiopvpc

Expand Down
1 change: 0 additions & 1 deletion aiopvpc/pvpc_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
)
from aiopvpc.pvpc_download import extract_pvpc_data, get_url_for_daily_json


_REQUEST_HEADERS = {
"User-Agent": "aioPVPC Python library",
"Accept": "application/json",
Expand Down
48 changes: 42 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[tool.isort]
profile = "black"
line_length = 88

[tool.black]
line_length = 88
target_version = ["py38", "py39"]
target_version = ["py39"]

[tool.coverage.run]
branch = true
Expand Down Expand Up @@ -36,7 +40,7 @@ markers = [

[tool.poetry]
name = "aiopvpc"
version = "2.2.1"
version = "2.2.2"
description = "Retrieval of Spanish Electricity hourly prices (PVPC)"
authors = ["Eugenio Panadero <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pvpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from aiopvpc.const import OLD_TARIFS_IDS, REFERENCE_TZ
from aiopvpc.pvpc_data import PVPCData
from .conftest import MockAsyncSession, TZ_TEST
from tests.conftest import MockAsyncSession, TZ_TEST


@pytest.mark.parametrize(
Expand Down