Skip to content

Commit

Permalink
Merge pull request #31 from MEHRSHAD-MIRSHEKARY/feat/CI
Browse files Browse the repository at this point in the history
💚 Feat/ci
  • Loading branch information
ARYAN-NIKNEZHAD authored Nov 8, 2024
2 parents 08e758b + 0e8777e commit 45decce
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip"
directory: "/packages" # Location of the requirements.txt and requirements-dev.txt file
schedule:
interval: "weekly"

target-branch: "main"
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on: [push, pull_request]

jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage codecov pytest poetry
pip install -r packages/requirements-dev.txt
- name: Run tests with coverage
run: pytest --cov=data_generator --cov-report=xml

- name: Run Tox tests
run: tox

- name: Run pre-commit hooks
run: pre-commit run --all-files --config=.pre-commit-config-ci.yaml

- name: Upload coverage to Codecov
run: codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
name: Build and Release
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build package
run: |
poetry build
- name: Publish to PyPI
run: |
poetry publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
2 changes: 1 addition & 1 deletion .pre-commit-config-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
exclude: (migrations/|tests/|docs/).*

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.5.0
rev: v2.5.0
hooks:
- id: pyproject-fmt

Expand Down
6 changes: 3 additions & 3 deletions data_generator/management/commands/generate_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from random import choice
from typing import Any, Dict, List, Optional, TextIO, Union
from typing import Any, Dict, List, Optional, TextIO

from django.apps import apps
from django.core.management.base import BaseCommand
Expand All @@ -24,8 +24,8 @@ class Command(BaseCommand):

def __init__(
self,
stdout: TextIO | None = None,
stderr: TextIO | None = None,
stdout: Optional[TextIO] = None,
stderr: Optional[TextIO] = None,
no_color: bool = False,
force_color: bool = False,
):
Expand Down

0 comments on commit 45decce

Please sign in to comment.