From 0c2af1af4ded6b87d45026c3d9ce343be7f0174f Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 24 Oct 2024 22:31:51 -0300 Subject: [PATCH] build: add ci with github actions workflow --- .github/workflows/ci.yaml | 45 +++++++++++++++++++++++++++++++++++++++ pyproject.toml | 5 ++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..3839053 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,45 @@ +name: CI +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Lint commit messages + uses: wagoid/commitlint-github-action@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install PDM + run: | + pip install --user pdm + pdm self update + + - name: Install dependencies + run: pdm install + + - name: Cache PDM packages + uses: actions/cache@v4 + with: + path: ~/.cache/pdm + key: ${{ runner.os }}-pdm-${{ hashFiles('pdm.lock') }} + restore-keys: ${{ runner.os }}-pdm- + + - name: Lint code + run: pdm run lint + + - name: Run tests + run: pdm run test diff --git a/pyproject.toml b/pyproject.toml index b476d72..b6e8aef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,4 +36,7 @@ release = [ ] [tool.pdm.scripts] -test = "pytest -vvv" \ No newline at end of file +test = "pytest -vvv" +ruff = "ruff check" +isort = "isort olxquery tests --check-only --diff" +lint = {composite = ["ruff", "isort"]} \ No newline at end of file