From 072e98495442d509d1642b65a21846badf4ad9a9 Mon Sep 17 00:00:00 2001 From: Jon Stroop Date: Fri, 28 Feb 2025 23:09:51 -0500 Subject: [PATCH 1/2] ci setup --- .github/workflows/ci.yml | 149 +++++++++++++++++++++++++++++++++++++++ codecov.yml | 44 ++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 codecov.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d75c570 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,149 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Python 3.13 + uses: actions/setup-python@v4 + with: + python-version: "3.13" + + - name: Install PDM + run: | + python -m pip install --upgrade pip + pip install pdm + + - name: Install dependencies + run: | + pdm install -G:all + + - name: Run tests with coverage + run: | + pdm run pytest --cov-report=xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + fail_ci_if_error: true + + format: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Python 3.13 + uses: actions/setup-python@v4 + with: + python-version: "3.13" + + - name: Install PDM + run: | + python -m pip install --upgrade pip + pip install pdm + + - name: Install dependencies + run: | + pdm install -G:all + + - name: Check Black formatting + run: | + pdm run black --check . + + - name: Check isort + run: | + pdm run isort --check . + + - name: Check unused imports with autoflake + run: | + pdm run autoflake . -r --remove-unused-variables --remove-all-unused-imports --ignore-pass-after-docstring --exclude ./.venv/*,./_scripts/* --check + + type-check: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Python 3.13 + uses: actions/setup-python@v4 + with: + python-version: "3.13" + + - name: Install PDM + run: | + python -m pip install --upgrade pip + pip install pdm + + - name: Install dependencies + run: | + pdm install -G:all + + - name: Run mypy + run: | + pdm run mypy + + docs: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Python 3.13 + uses: actions/setup-python@v4 + with: + python-version: "3.13" + + - name: Install PDM + run: | + python -m pip install --upgrade pip + pip install pdm + + - name: Install dependencies + run: | + pdm install -G:all + + - name: Check markdown formatting + run: | + pdm run mdformat --check . + + build: + runs-on: ubuntu-latest + needs: [test, format, type-check, docs] + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Python 3.13 + uses: actions/setup-python@v4 + with: + python-version: "3.13" + + - name: Install PDM + run: | + python -m pip install --upgrade pip + pip install pdm + + - name: Install dependencies + run: | + pdm install -G:all + + - name: Build package + run: | + pdm build \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..c1ca2f7 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,44 @@ +codecov: + require_ci_to_pass: yes + strict_yaml_branch: main + +coverage: + precision: 2 + round: down + range: "95...100" + status: + project: + default: + target: 100% + threshold: 0% + base: auto + branches: + - main + if_not_found: failure + if_ci_failed: error + informational: false + only_pulls: false + patch: + default: + target: 100% + threshold: 0% + base: auto + branches: + - main + if_not_found: failure + if_ci_failed: error + informational: false + only_pulls: false + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach,diff,flags,files,footer" + behavior: default + require_changes: no \ No newline at end of file From c5e9bebcc56431bf5354d897d774b291e9de5ad6 Mon Sep 17 00:00:00 2001 From: Jon Stroop Date: Sat, 1 Mar 2025 01:12:28 -0500 Subject: [PATCH 2/2] try latest version --- .github/workflows/ci.yml | 2 +- README.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84bac6c..2b886e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: pdm run pytest --cov-report=xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5.4.0 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml diff --git a/README.md b/README.md index ae7c895..526c4b2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ # Fitbit Client -[![CI](https://github.com/jpstroop/fitbit-client/actions/workflows/ci.yml/badge.svg)](https://github.com/jpstroop/fitbit-client/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/jpstroop/fitbit-client/branch/main/graph/badge.svg)](https://codecov.io/gh/jpstroop/fitbit-client) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/release/python-3130/)