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

add static analysis and ci/cd #1

Closed
wants to merge 1 commit into from
Closed
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
71 changes: 71 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Main Workflow

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Install dependencies
run: |
poetry install --with dev
- name: Run ruff check
run: |
source .venv/bin/activate
ruff check
- name: Run ruff format check
run: |
source .venv/bin/activate
ruff format --check

publish:
needs: lint
# Only run on push to the main branch
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Install dependencies
run: |
poetry install --no-dev
- name: Get version from pyproject.toml
id: get_version
run: |
VERSION=$(poetry version -s)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build package
run: poetry build
- name: Publish to PyPI
if: "!contains(steps.get_version.outputs.version, '-dev')"
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
29 changes: 28 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ scikit-learn = "^1.5.2"
numpy = "^2.1.2"
tqdm = "^4.66.5"

[tool.poetry.dev-dependencies]
ruff = "^0.6.9"

[tool.poetry.scripts]
quizgen = "quizgen.quizgen:main"

Expand Down