Skip to content

Commit

Permalink
Merge pull request #1 from gMatas/initial-commit
Browse files Browse the repository at this point in the history
feat(ci): Add initial CI pipeline
  • Loading branch information
gMatas authored Dec 26, 2024
2 parents 822d3f9 + 6dffb13 commit 3ddcc42
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Main pipeline

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
validate:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.10" ]
env:
POETRY_HOME: /opt/poetry
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Check Python version
run: python --version
- name: Install poetry
run: |
python -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install "poetry~=1.7.1"
$POETRY_HOME/bin/poetry --version
- name: Install package
run: |
$POETRY_HOME/bin/poetry install --with dev
- name: Validate
run: |
$POETRY_HOME/bin/poetry run ruff check
$POETRY_HOME/bin/poetry run ruff format --check
$POETRY_HOME/bin/poetry run mypy src/ tests/
- name: Run tests
run: |
$POETRY_HOME/bin/poetry run pytest tests/
build-and-publish:
needs: validate
# Only run if it's on main branch.
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
env:
POETRY_HOME: /opt/poetry
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Check Python version
run: python --version
- name: Install poetry
run: |
python -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install "poetry~=1.7.1"
$POETRY_HOME/bin/poetry --version
- name: Install package
run: |
$POETRY_HOME/bin/poetry install --with dev
- name: Validate
run: |
$POETRY_HOME/bin/poetry run ruff check
$POETRY_HOME/bin/poetry run ruff format --check
$POETRY_HOME/bin/poetry run mypy src/ tests/
- name: Run tests
run: |
$POETRY_HOME/bin/poetry run pytest tests/
- name: Build
run: |
$POETRY_HOME/bin/poetry build
- name: Publish to PyPI
run: |
$POETRY_HOME/bin/poetry publish -u __token__ -p $PYPI_API_TOKEN

0 comments on commit 3ddcc42

Please sign in to comment.