From 399474a32b95df303b2cd0dd188674497f81f236 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 8 Aug 2025 21:29:10 +0000 Subject: [PATCH 1/2] feat: Add GitHub CI for test and ruff check This commit adds a GitHub Actions workflow to automate testing and code style checking. The workflow includes two jobs: - 'test': runs pytest with coverage reports. - 'ruff_check': runs ruff for linting and formatting checks. This is inspired by the provided gitlab ci example. --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..390cfe1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + 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 + + 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' From f123acc447a8ad3175625daf82f4d0c091741771 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 8 Aug 2025 21:41:28 +0000 Subject: [PATCH 2/2] feat: Add Codecov badge to README This commit updates the CI workflow to upload coverage reports to Codecov and adds a Codecov badge to the README.md file. The CI now uses OIDC to authenticate with Codecov, which is more secure than using a secret token. The README now displays the code coverage status, providing better visibility into the project's test quality. --- .github/workflows/ci.yml | 6 ++++++ README.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 390cfe1..e79e2f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,8 @@ on: jobs: test: runs-on: ubuntu-latest + permissions: + id-token: write # to get the OIDC token steps: - uses: actions/checkout@v4 - name: Set up Python @@ -30,6 +32,10 @@ jobs: 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 diff --git a/README.md b/README.md index 8e6ccc4..20e0c53 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Tomlscript +[](https://codecov.io/gh/phihung/tomlscript) + A lightweight, dependency-free tool to manage your scripts directly from pyproject.toml