Skip to content

Commit

Permalink
refactor: update git workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MVladislav committed Nov 23, 2024
1 parent 92155af commit 6c131b4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
39 changes: 26 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

env:
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: "3.12"
PROJECT_PATH: "vm_clockify"

jobs:
Expand All @@ -20,45 +20,58 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout repository
uses: "actions/checkout@v4"
uses: actions/checkout@v4

# https://github.com/actions/setup-python
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "pip"
cache-dependency-path: "requirements*"
cache-dependency-path: |
pyproject.toml
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
python3 -m pip install .
python3 -m pip install .[dev]
# Following steps cannot run by pre-commit.ci as repo = local
- name: Run mypy
run: mypy ${{ env.PROJECT_PATH }}/
- name: Pylint review
run: pylint ${{ env.PROJECT_PATH }}/

tests:
runs-on: ubuntu-latest
name: Run tests
runs-on: ubuntu-latest

steps:
# https://github.com/actions/checkout
- name: Checkout repository
uses: "actions/checkout@v4"
uses: actions/checkout@v4

# https://github.com/actions/setup-python
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "pip"
cache-dependency-path: "requirements*"
cache-dependency-path: |
pyproject.toml
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
python3 -m pip install .
python3 -m pip install .[dev]
- name: Run pytest
run: pytest --cov=./ --cov-report=xml
run: pytest --cov=./ --cov-report=xml --junitxml=pytest-report.xml --cov-fail-under=80

# - name: Upload test results
# uses: actions/upload-artifact@v4
# with:
# name: test-results
# path: pytest-report.xml

# - name: Upload coverage results
# uses: actions/upload-artifact@v4
# with:
# name: coverage-results
# path: coverage.xml
26 changes: 11 additions & 15 deletions .github/workflows/python-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

env:
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: "3.12"

GIT_BRANCH_NAME: "${{ github.ref }}"
GIT_REPOSITORY_NAME: "${{ github.event.repository.name }}"
Expand All @@ -34,19 +34,20 @@ jobs:
steps:
- uses: actions/checkout@v4

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

- name: install dependencies
- name: Install build dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pip build
- name: build binary wheel and a source tarball
run: python3 setup.py sdist
- name: Build binary wheel and source tarball
run: |
python3 -m build
- name: archive production artifacts
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}
Expand All @@ -62,7 +63,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: set up Python ${{ env.DEFAULT_PYTHON }}
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
Expand All @@ -73,11 +74,6 @@ jobs:
name: ${{ env.PROJECT_NAME }}
path: artifacts

- name: un-tar final result
run: |
tar xvf vm_clockify-*.tar.gz
working-directory: artifacts

- name: install final result
- name: Install final result
run: |
python3 -m pip install .
python3 -m pip install artifacts/*.whl

0 comments on commit 6c131b4

Please sign in to comment.