diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..98cd559 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +on: + pull_request: + branches: + - "main" + - "develop" + push: + tags: + - "v*" + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python_version: ["3.7", "3.8", "3.9", "3.10"] + steps: + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python_version }} + - run: pip install --upgrade pip poetry coveralls + - uses: actions/checkout@v2 + - run: poetry install + - run: poetry run pytest --cov=fastapi_firebase + - run: poetry run coverage lcov + - name: Upload coverage data to coveralls.io + run: coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: python${{ matrix.python_version }} + COVERALLS_PARALLEL: true + + coveralls: + name: Indicate completion to coveralls.io + needs: test + runs-on: ubuntu-latest + container: + image: python:3-slim + steps: + - name: Finished + run: | + pip3 install --upgrade coveralls + coveralls --service=github --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + deploy: + name: Publish package + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - uses: actions/checkout@v2 + - run: pip install --upgrade pip poetry + name: Install dependencies + - run: poetry build + name: Build package + - run: poetry publish + if: startsWith(github.ref, 'refs/tags/') + env: + PYPI_USERNAME: __token__ + PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }} + - uses: softprops/action-gh-release@v0.1.14 + if: startsWith(github.ref, 'refs/tags/') + with: + files: dist/* diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml new file mode 100644 index 0000000..32480ae --- /dev/null +++ b/.github/workflows/code-checks.yml @@ -0,0 +1,19 @@ +name: Code quality checks + +on: + pull_request: + +jobs: + lint_code: + name: Lint code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python_version: 3.9 + - run: pip install poetry + - run: poetry install + id: deps + - run: poetry run flake8 + - run: poetry run mypy . diff --git a/pyproject.toml b/pyproject.toml index 94a2c5d..472faa7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ exclude = [ ] name = "fastapi-firebase" readme = "README.md" -version = "0.1.0" +version = "0.1.1a1" [tool.poetry.dependencies] fastapi = "^0.60.0" @@ -34,5 +34,8 @@ requires = ["poetry-core>=1.0.0"] line_length = 100 profile = "black" -[tol.black] +[tool.black] line-length = 100 + +[tool.mypy] +ignore_missing_imports = true diff --git a/tests/test_app.py b/tests/test_app.py index b9ae7e7..55ddb1f 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1,6 +1,6 @@ import pytest from fastapi import Depends, FastAPI, testclient -from firebase_admin import App, _DEFAULT_APP_NAME +from firebase_admin import App from fastapi_firebase import app as fire