From 4c09539f7a5c1a5f13489197d65a34e9e5ce79ec Mon Sep 17 00:00:00 2001 From: Ray Okamoto Date: Tue, 14 Jan 2025 17:47:56 +1030 Subject: [PATCH] ci: add linting and formatting workflow --- .github/workflows/ci-dev.yml | 20 +++++++++++++++ .github/workflows/lint-and-format.yml | 35 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/ci-dev.yml create mode 100644 .github/workflows/lint-and-format.yml diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml new file mode 100644 index 0000000..8a3f2ab --- /dev/null +++ b/.github/workflows/ci-dev.yml @@ -0,0 +1,20 @@ +name: Development +on: + pull_request: + branches: + - "**" + +jobs: + lint_and_format: + name: Linting and formatting checks + uses: ./.github/workflows/lint-and-format.yml + + # build: + # needs: lint_and_format + # name: Build + # runs-on: ubuntu-latest + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + + # # TODO diff --git a/.github/workflows/lint-and-format.yml b/.github/workflows/lint-and-format.yml new file mode 100644 index 0000000..729d4a8 --- /dev/null +++ b/.github/workflows/lint-and-format.yml @@ -0,0 +1,35 @@ +name: Linting and formatting checks +on: + workflow_call: + +jobs: + lint_and_format: + name: Lint and Format + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + cache-dependency-glob: "uv.lock" + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + uv sync + + - name: Check for linting errors + run: | + uv run ruff check + + - name: Check formatting + run: | + uv run ruff format --check