diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..62d0fe8 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,59 @@ +name: CI + +on: + push: + pull_request: + +jobs: + run-test: + name: Run Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12.12" + enable-cache: true + + - name: Install Dependencies + run: | + uv venv --allow-existing + uv pip install -r requirements.txt -r requirements-dev.txt + + - name: Run Tests + run: | + source .venv/bin/activate + pytest --cov-branch --cov --cov-report=xml + + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v5 + with: + files: coverage.xml + fail_ci_if_error: true + use_pypi: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + check-linting: + name: Check Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12.12" + enable-cache: true + + - name: Install Dependencies + run: | + uv venv --allow-existing + uv pip install -r requirements.txt -r requirements-dev.txt + + - name: Run Ruff + run: | + source .venv/bin/activate + ruff check sample_package tests diff --git a/README.md b/README.md index 950140f..3e35c58 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Python Project Setup [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -[![cosmoquester](https://circleci.com/gh/cosmoquester/python3-template.svg?style=svg)](https://app.circleci.com/pipelines/github/cosmoquester/python3-template) +[![CircleCI](https://circleci.com/gh/cosmoquester/python3-template.svg?style=svg)](https://app.circleci.com/pipelines/github/cosmoquester/python3-template) +[![GithubAction](https://github.com/cosmoquester/python3-template/actions/workflows/validate.yml/badge.svg)](https://github.com/cosmoquester/python3-template/actions/workflows/validate.yml) - This repository is template for my python project