-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/GitHub actions #44
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6b56760
feat: github actions CI pipeline
gastonva 8eeb0fa
fix: github actions wip, run on all branches
gastonva 1f37105
fix: typo in workflows folder
gastonva fb0d86f
fix: remove pure pytest step and only use coverage
gastonva 0f7d9c5
fix: wip run tests
gastonva 19c473f
fix: wip run tests with postgres image
gastonva 526853b
fix: wip run tests with postgres image in the background
gastonva d8924e3
fix: make settings optional
gastonva c942099
fix: add all env vars (wip test step)
gastonva 354398b
fix: still wip in test step
gastonva 341b57c
fix: testing preinstalled postgresql db
gastonva f2413f0
fix: testing postgresql service
gastonva 6db68dc
fix: testing postgresql service v2
gastonva 3ba4842
chore: resolve merge conflicts with main
gastonva a691519
fix: missing env var
gastonva 16f1730
fix: missing celery env vars
gastonva 417a1a4
feat: add ruff and pre-commit, also add cache to the GA docker build …
gastonva 3175776
fix: indentation
gastonva c178b93
chore: PR feedback changes
gastonva c959516
chore: remove .coverage file
gastonva 70b3318
chore: merge from main
gastonva 8510438
style: run pre-commit
gastonva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,113 @@ | ||
| name: CI Pipeline Template | ||
|
|
||
| 'on': | ||
| push: | ||
| branches: | ||
| - '**' | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
|
|
||
| jobs: | ||
| lint-and-format: | ||
| name: Run Linters & Formatters | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.13 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install poetry | ||
| poetry install --no-root --with dev | ||
|
|
||
| - name: Install pre-commit | ||
| run: pip install pre-commit | ||
| - name: Run linters and formatters | ||
| run: pre-commit run --all-files | ||
|
|
||
| tests: | ||
| name: Run Tests | ||
| runs-on: ubuntu-latest | ||
| needs: lint-and-format | ||
| timeout-minutes: 15 | ||
| services: | ||
| postgres: | ||
| image: postgres:16 | ||
| env: | ||
| POSTGRES_USER: dev | ||
| POSTGRES_PASSWORD: dev | ||
| POSTGRES_DB: dev | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd "pg_isready -U dev -d dev" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| env: | ||
| PROJECT_NAME: python-template | ||
| DATABASE_URL: postgresql://dev:dev@localhost:5432/dev | ||
| ASYNC_DATABASE_URL: postgresql+asyncpg://dev:dev@localhost:5432/dev | ||
| DATABASE_POOL_PRE_PING: True | ||
| DATABASE_POOL_SIZE: 5 | ||
| DATABASE_POOL_RECYCLE: 3600 | ||
| DATABASE_MAX_OVERFLOW: 10 | ||
| LOG_LEVEL: DEBUG | ||
| SERVER_URL: example.com | ||
| ACCESS_TOKEN_EXPIRE_MINUTES: 15 | ||
| JWT_SIGNING_KEY: your-signing-key | ||
| CELERY_BROKER_URL: amqp://guest:guest@rabbitmq:5672 | ||
| CELERY_RESULT_BACKEND: redis://redis:6379/0 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.13 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install poetry | ||
| poetry install --no-root --with dev | ||
|
|
||
| - name: Run tests with coverage | ||
| run: | | ||
| poetry run coverage run -m pytest | ||
gastonva marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| poetry run coverage report -m --fail-under=80 | ||
|
|
||
| docker-build: | ||
| name: Build Docker Image | ||
| runs-on: ubuntu-latest | ||
| needs: tests | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
gastonva marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Cache Docker layers | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/.buildx-cache | ||
| key: ${{ runner.os }}-docker-${{ github.sha }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-docker- | ||
gastonva marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Build image with cache | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| push: false | ||
| tags: python-template:latest | ||
| cache-from: type=local,src=/tmp/.buildx-cache | ||
| cache-to: type=local,dest=/tmp/.buildx-cache,mode=max | ||
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,32 @@ | ||
| # See https://pre-commit.com/hooks.html for more hooks | ||
| default_stages: [pre-commit, pre-push] | ||
| files: ^src/|^alembic/versions/ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v3.2.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| - id: check-yaml | ||
| - id: check-added-large-files | ||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| # Ruff version. | ||
| rev: v0.5.5 | ||
| hooks: | ||
| # Run the linter. | ||
| - id: ruff | ||
| args: [ --select=I, --fix ] | ||
| # Run the formatter. | ||
| - id: ruff-format | ||
|
|
||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: 'v1.8.0' | ||
| hooks: | ||
| - id: mypy | ||
| exclude: ^src/alembic/|^scripts/|^\\.devcontainer/|^\\.github/ | ||
| additional_dependencies: [ | ||
| pydantic==2.10.6, | ||
| SQLAlchemy==2.0.39, | ||
| types-mock==5.2.0.20250306 | ||
| ] |
This file contains hidden or 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
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.