From dafb4db50b0e846cd639dec1f1dc3494b33bc1f9 Mon Sep 17 00:00:00 2001 From: codingfabi Date: Sat, 4 May 2024 22:09:54 +0200 Subject: [PATCH 1/3] add production pipieline yml --- .github/workflows/ci-production.yml | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/ci-production.yml diff --git a/.github/workflows/ci-production.yml b/.github/workflows/ci-production.yml new file mode 100644 index 0000000..88fa29f --- /dev/null +++ b/.github/workflows/ci-production.yml @@ -0,0 +1,66 @@ +name: Continuous Integration + +on: + push: + branches: + - main + release: + types: + - created + +jobs: + test: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up testing python ${{ matrix.config.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.config.python-version }} + - name: Install poetry + uses: abatilo/actions-poetry@v2.3.0 + - name: Setup a local virtual environment for caching + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - name: Define a cache for the virtual environment based on the dependencies lock file to speed up later runs + uses: actions/cache@v3 + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install dependencies + run: poetry install --no-root --without dev + - name: Pytest + run: poetry run pytest -x --random-order + + build-and-publish: + name: Build and publish Python distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-22.04 + needs: + - test + steps: + - uses: actions/checkout@v4 + - name: Set up base Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Python Poetry Action + uses: abatilo/actions-poetry@v2.3.0 + - name: Publish distribution 📦 with test.pypi.org + if: startsWith(github.ref, 'refs/tags') + run: | + poetry config repositories.testpypi https://test.pypi.org/legacy/ + poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }} + poetry build + poetry publish -r testpypi + - name: Publish distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags') + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} + poetry build + poetry publish From 74c6c38284b95ba943659267a8425221131a8271 Mon Sep 17 00:00:00 2001 From: codingfabi Date: Sun, 5 May 2024 09:44:32 +0200 Subject: [PATCH 2/3] remove deployment to pypi --- .github/workflows/ci-production.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci-production.yml b/.github/workflows/ci-production.yml index 88fa29f..79877fc 100644 --- a/.github/workflows/ci-production.yml +++ b/.github/workflows/ci-production.yml @@ -58,9 +58,3 @@ jobs: poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }} poetry build poetry publish -r testpypi - - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') - run: | - poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} - poetry build - poetry publish From 98f13498bf45d6e79345a38dba32fbf783ea1480 Mon Sep 17 00:00:00 2001 From: codingfabi Date: Sun, 5 May 2024 09:57:24 +0200 Subject: [PATCH 3/3] adjust version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ca4d439..6eccaa7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "co2calculator" -version = "0.1.0" +version = "0.1.1b" description = "Calculates CO2e emissions from travel and commuting as well as heating and electricity consumption of buildings" authors = ["pledge4future Team "] license = "GPL 3"