-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gMatas/initial-commit
feat(ci): Add initial CI pipeline
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |