diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e79e2f0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + permissions: + id-token: write # to get the OIDC token + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: Cache uv dependencies + uses: actions/cache@v4 + with: + path: .uv-cache + key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }} + - name: Install dependencies + run: uv sync --all-extras --cache-dir .uv-cache + - name: Run tests + run: uv run pytest --cov src --cov-branch --cov-report term --cov-report xml:coverage.xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + use_oidc: true + + ruff_check: + name: ruff + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run ruff + uses: astral-sh/ruff-action@v1 + with: + args: 'check --output-format=github' + - name: Run ruff format + uses: astral-sh/ruff-action@v1 + with: + args: 'format --check' diff --git a/README.md b/README.md index 8e6ccc4..20e0c53 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Tomlscript +[![codecov](https://codecov.io/gh/phihung/tomlscript/branch/main/graph/badge.svg)](https://codecov.io/gh/phihung/tomlscript) + A lightweight, dependency-free tool to manage your scripts directly from pyproject.toml