From fe486784dce13792c474794bbe525476bdc8fed9 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Mon, 11 Nov 2024 22:04:17 +0800 Subject: [PATCH] feat: add GitHub CI --- .github/dependabot.yml | 11 ++++++++ .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f11e69e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 + +updates: + - package-ecosystem: pip + directory: / + schedule: + interval: daily + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..14a93ac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: [push, fork, pull_request, workflow_dispatch] + +jobs: + check: + 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 dependencies + run: | + pip install uv --disable-pip-version-check + uvx pdm export --pyproject | uv pip install -r - --system + yarn global add pyright + - name: Check code quality + run: | + ruff check --diff + isort . --check --diff + black . --check --diff + - name: Check typing + run: pyright + + build: + 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 dependencies + run: pip install uv --disable-pip-version-check + - name: Build + run: uv build + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist + + publish: + runs-on: ubuntu-latest + needs: [check, build] + permissions: + id-token: write + if: github.event_name != 'pull_request' + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Publish to PyPI + run: | + pip install uv --disable-pip-version-check + uv publish + continue-on-error: true