From fb34cb4e6cd98e4c396050d1207c3ebc79da382f Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 11:33:34 -0300 Subject: [PATCH 01/17] Added a code check workflow. --- .github/workflows/code-checks.ym | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/code-checks.ym diff --git a/.github/workflows/code-checks.ym b/.github/workflows/code-checks.ym new file mode 100644 index 0000000..1882028 --- /dev/null +++ b/.github/workflows/code-checks.ym @@ -0,0 +1,25 @@ +name: Code checks +on: + pull_request: + branches: + - develop + - main + - release/** + push: + branches_exclude: + - develop + - main + +jobs: + pre_commit: + name: Pre-commit + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2.3.1 + with: + python_version: 3.9 + + - run: "pip install pre-commit" + - run: "pre-commit install" + - run: "pre-commit run" From fe357a4627e5f4e7e587084e667853c319d37306 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 15:51:07 -0300 Subject: [PATCH 02/17] Added a test workflow. --- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..220be63 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +on: + push: + branches-ignore: + - "main" + - "develop" + pull_request: + branches: + - "main" + - "develop" + +jobs: + run_tests: + 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 + - run: pip install --upgrade pip poetry + - uses: actions/checkout@v2 + - run: poetry install + - run: poetry run pytest --cov=fastapi_firebase + - run: poetry run coverage lcov + - name: Code Coverage Report + uses: romeovs/lcov-reporter-action@v0.2.11 + with: + lcov-file: ./coverage.lcov From 81d7089f9037acc715341225498e3a7d9598153f Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 15:59:07 -0300 Subject: [PATCH 03/17] Removed the push trigger from the test workflow, leaving the workflow only for pull requests. --- .github/workflows/test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 220be63..7901bfc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,4 @@ on: - push: - branches-ignore: - - "main" - - "develop" pull_request: branches: - "main" From f6a2c227a24efbb0cfab12041c0ed4fff00fef94 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 16:02:18 -0300 Subject: [PATCH 04/17] Removed the code coverage report because it is not working. --- .github/workflows/code-checks.ym | 25 ------------------------- .github/workflows/deployment.yml | 12 ++++++++++++ .github/workflows/test.yml | 4 ---- 3 files changed, 12 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/code-checks.ym create mode 100644 .github/workflows/deployment.yml diff --git a/.github/workflows/code-checks.ym b/.github/workflows/code-checks.ym deleted file mode 100644 index 1882028..0000000 --- a/.github/workflows/code-checks.ym +++ /dev/null @@ -1,25 +0,0 @@ -name: Code checks -on: - pull_request: - branches: - - develop - - main - - release/** - push: - branches_exclude: - - develop - - main - -jobs: - pre_commit: - name: Pre-commit - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2.3.1 - with: - python_version: 3.9 - - - run: "pip install pre-commit" - - run: "pre-commit install" - - run: "pre-commit run" diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..0ed670f --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,12 @@ +on: + push: + tags: + - "v*" + +jobs: + deploy_to_pipy: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v2 + with: + python_version: 3.9 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7901bfc..6b1f960 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,3 @@ jobs: - run: poetry install - run: poetry run pytest --cov=fastapi_firebase - run: poetry run coverage lcov - - name: Code Coverage Report - uses: romeovs/lcov-reporter-action@v0.2.11 - with: - lcov-file: ./coverage.lcov From 853d3af062e0150b3bf0e05dc9525ad31ff6d0f1 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 16:15:04 -0300 Subject: [PATCH 05/17] Added code checks to run flake8 and mypy. --- .github/workflows/code-checks.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/code-checks.yml diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml new file mode 100644 index 0000000..1722573 --- /dev/null +++ b/.github/workflows/code-checks.yml @@ -0,0 +1,18 @@ +name: Code quality checks + +on: + pull_request: + +jobs: + lint_code: + name: Lint code + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python_version: + - run: pip install poetry + - run: poetry install + id: deps + - run: poetry run flake8 + - run: poetry run mypy . From ddb575a32880eb9498f0f2b48354a0e80c826fcd Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 16:16:27 -0300 Subject: [PATCH 06/17] Fixed code check workflow file. --- .github/workflows/code-checks.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 1722573..32480ae 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -6,11 +6,12 @@ on: jobs: lint_code: name: Lint code + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python_version: + python_version: 3.9 - run: pip install poetry - run: poetry install id: deps From 933863a7771c22d7af15946af3349f801e5ab61c Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 16:25:02 -0300 Subject: [PATCH 07/17] Updated mypy configuration. --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 94a2c5d..896edcc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 From f7e28402a8d6113ed40ee1efc8f80e5d1fa883c8 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 16:25:13 -0300 Subject: [PATCH 08/17] Fixed a flake8 error. --- tests/test_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From d7ce769fc9e10a284c51fd0e997216de216f8a85 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 16:50:47 -0300 Subject: [PATCH 09/17] Added coveralls support. --- .github/workflows/test.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b1f960..7d2b3b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ on: - "develop" jobs: - run_tests: + test: runs-on: ubuntu-latest strategy: fail-fast: true @@ -18,3 +18,22 @@ jobs: - 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: python:3-slim + steps: + - name: Finished + run: | + pip3 install --upgrade coveralls + coveralls --service=github --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b6a0e7a4b8b508b53130326c7e813f8d23ec7acb Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Tue, 1 Feb 2022 16:53:44 -0300 Subject: [PATCH 10/17] Fixed coveralls workflow. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d2b3b3..0f6bfd2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: python_version: ["3.7", "3.8", "3.9", "3.10"] steps: - uses: actions/setup-python@v2 - - run: pip install --upgrade pip poetry + - run: pip install --upgrade pip poetry coveralls - uses: actions/checkout@v2 - run: poetry install - run: poetry run pytest --cov=fastapi_firebase From 05e9c16e64d59f76931f2332409747d8f7738076 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Wed, 2 Feb 2022 10:18:35 -0300 Subject: [PATCH 11/17] Finished testing workflow. --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f6bfd2..a52ed06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,8 @@ jobs: 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 @@ -29,7 +31,8 @@ jobs: name: Indicate completion to coveralls.io needs: test runs-on: ubuntu-latest - container: python:3-slim + container: + image: python:3-slim steps: - name: Finished run: | From 27a416cb30ca399cf808ee7fc88c60f61a667415 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Wed, 2 Feb 2022 10:49:17 -0300 Subject: [PATCH 12/17] Fixed deployment step. --- .github/workflows/deployment.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 0ed670f..dc8ac46 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -5,8 +5,18 @@ on: jobs: deploy_to_pipy: + name: Publish package runs-on: ubuntu-latest steps: - uses: actions/setup-python@v2 with: - python_version: 3.9 + 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 + env: + PYPI_USERNAME: __token__ + PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }} From be61e6c9e59bc1d9d7e6e8cd9dbabf059f3fa100 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Wed, 2 Feb 2022 11:04:12 -0300 Subject: [PATCH 13/17] Added deployment support for pull requests. --- .github/workflows/deployment.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index dc8ac46..d97e013 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -2,6 +2,8 @@ on: push: tags: - "v*" + pull_request: + branches: ["main", "develop"] jobs: deploy_to_pipy: @@ -17,6 +19,10 @@ jobs: - 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 + with: + files: dist/* From 1f7d7ac5c6daf046c1654fc5622602fe91607df9 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Wed, 2 Feb 2022 11:45:31 -0300 Subject: [PATCH 14/17] Fixed deployment when running for a pull request. --- .github/workflows/deployment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index d97e013..9d102cf 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -24,5 +24,6 @@ jobs: 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/* From 212ab95c64a791b24d6ca748add9eaa247143b09 Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Wed, 2 Feb 2022 11:46:11 -0300 Subject: [PATCH 15/17] Renamed the workflow file. --- .github/workflows/{test.yml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test.yml => ci.yml} (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml From 0bc025cee1ef95bbf5210f62a4e276d9c95ebaab Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Wed, 2 Feb 2022 11:48:25 -0300 Subject: [PATCH 16/17] Unified test and deployment. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ .github/workflows/deployment.yml | 29 ----------------------------- 2 files changed, 26 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/deployment.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a52ed06..98cd559 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,9 @@ on: branches: - "main" - "develop" + push: + tags: + - "v*" jobs: test: @@ -40,3 +43,26 @@ jobs: 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/deployment.yml b/.github/workflows/deployment.yml deleted file mode 100644 index 9d102cf..0000000 --- a/.github/workflows/deployment.yml +++ /dev/null @@ -1,29 +0,0 @@ -on: - push: - tags: - - "v*" - pull_request: - branches: ["main", "develop"] - -jobs: - deploy_to_pipy: - name: Publish package - 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/* From 981e8b08686c720b6f8400cc4e3671cbfb40cf8a Mon Sep 17 00:00:00 2001 From: Francisco Del Roio Date: Wed, 2 Feb 2022 11:55:15 -0300 Subject: [PATCH 17/17] Bumped to version 1.0.1a1. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 896edcc..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"