From ed6c748fe316d2ebb7ae3f7010187e195cb089ab Mon Sep 17 00:00:00 2001 From: ltenorio Date: Tue, 12 Nov 2024 10:21:02 +0100 Subject: [PATCH] add initial github action --- .github/dependabot.yml | 25 +++++++++++ .github/workflows/ci.yml | 95 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 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 00000000..c632561c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,25 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + # Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.) + directory: "/" + schedule: + interval: "daily" + labels: + - 'dependencies' + + # Maintain dependencies for PyPI + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + labels: + - 'dependencies' + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..c05498be --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,95 @@ +name: CI + +on: + pull_request: + workflow_dispatch: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 2 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[all] + + - name: Lint code + run: | + ruff check . + + test: + needs: lint + runs-on: ubuntu-latest + timeout-minutes: 5 + + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install system dependencies + run: sudo apt-get install -y graphviz + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[all] + + - name: Run tests + run: | + pytest + + - name: Coverage report + run: | + coverage xml + coverage report + + - name: Upload coverage artifact + uses: actions/upload-artifact@v4 + with: + name: coverage_${{ matrix.os }}_py-${{ matrix.python-version }} + path: coverage.xml + retention-days: 7 + + # coverage: + # needs: test + # runs-on: ubuntu-latest + # timeout-minutes: 2 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Download coverage artifacts + # uses: actions/download-artifact@v4 + + # - name: Codecov upload + # uses: codecov/codecov-action@v4 + # with: + # name: ${{ github.workflow }} + # flags: fast-tests + # fail_ci_if_error: true + # verbose: true + # # Token not required for public repos, but avoids upload failure due + # # to rate-limiting (but not for PRs opened from forks) + # token: ${{ secrets.CODECOV_TOKEN }}