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

chore: add production pipeline config #174

Merged
merged 3 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <info@pledge4future.org>"]
license = "GPL 3"
Expand Down
Loading