Skip to content

Commit

Permalink
test: update ci-cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MountainGod2 committed Apr 2, 2024
1 parent 2882e5e commit bb2850b
Showing 1 changed file with 47 additions and 31 deletions.
78 changes: 47 additions & 31 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,57 @@ jobs:

# Define job steps
steps:
- name: Set up Python
uses: actions/setup-python@v4
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: "3.10"

- name: Check-out repository
uses: actions/checkout@v3

- name: Install poetry
python-version: '3.12'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install

- name: Format with ruff
run: poetry run ruff format

- name: Lint with ruff
run: poetry run ruff check --fix

- name: Run tests
run: |
source .venv/bin/activate
pytest tests/ --cov=chaturbate_poller --cov-report=xml
- name: Use Codecov to track coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# run test suite and output coverage file
#----------------------------------------------
- name: Test with pytest
run: poetry run pytest --cov=chaturbate_poller --cov-report=xml
#----------------------------------------------
# upload coverage stats
# (requires CODECOV_TOKEN in repository secrets)
#----------------------------------------------
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: MountainGod2/chaturbate_poller
token: ${{ secrets.CODECOV_TOKEN }} # Only required for private repositories
file: ./coverage.xml
fail_ci_if_error: true

- name: Build documentation
run: poetry run make clean html --directory docs/
Expand Down

0 comments on commit bb2850b

Please sign in to comment.