From c3a877107602df820cc42b16ee8f44dfce519a51 Mon Sep 17 00:00:00 2001 From: Hans Maerki Date: Sun, 30 Jun 2024 12:49:01 +0200 Subject: [PATCH] Initial gitlab workflow --- .github/workflows/test.yml | 28 +++++++++------------------- scripts/lint.sh | 8 ++++++++ 2 files changed, 17 insertions(+), 19 deletions(-) create mode 100755 scripts/lint.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c29e3f0..f4fa47f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,9 @@ name: Test on: push: - branches: - - master + workflow_dispatch: +# branches: +# - master pull_request: types: - opened @@ -12,6 +13,7 @@ on: # cron every week on monday - cron: "0 0 * * 1" + jobs: lint: runs-on: ubuntu-latest @@ -24,7 +26,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" # Issue ref: https://github.com/actions/setup-python/issues/436 # cache: "pip" # cache-dependency-path: pyproject.toml @@ -32,12 +34,10 @@ jobs: id: cache with: path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-pydantic-v2-${{ hashFiles('pyproject.toml', 'requirements-tests.txt', 'requirements-docs-tests.txt') }}-test-v08 + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt', 'requirements-docs-tests.txt') }}-test-v08 - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-tests.txt - - name: Install Pydantic v2 - run: pip install "pydantic>=2.0.2,<3.0.0" + run: pip install -r requirements.txt -r requirements-dev.txt - name: Lint run: bash scripts/lint.sh @@ -47,11 +47,7 @@ jobs: matrix: python-version: - "3.12" - - "3.11" - "3.10" - - "3.9" - - "3.8" - pydantic-version: ["pydantic-v1", "pydantic-v2"] fail-fast: false steps: - name: Dump GitHub context @@ -70,16 +66,10 @@ jobs: id: cache with: path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ matrix.pydantic-version }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt', 'requirements-docs-tests.txt') }}-test-v08 + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements_dev.txt') }}-test-v08 - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-tests.txt - - name: Install Pydantic v1 - if: matrix.pydantic-version == 'pydantic-v1' - run: pip install "pydantic>=1.10.0,<2.0.0" - - name: Install Pydantic v2 - if: matrix.pydantic-version == 'pydantic-v2' - run: pip install "pydantic>=2.0.2,<3.0.0" + run: pip install -r requirements.txt -r requirements_dev.txt - run: mkdir coverage - name: Test run: bash scripts/test.sh diff --git a/scripts/lint.sh b/scripts/lint.sh new file mode 100755 index 0000000..779a160 --- /dev/null +++ b/scripts/lint.sh @@ -0,0 +1,8 @@ +set -euox pipefail + + +ruff check --config pyproject.toml --fix || true + +python -m mypy --config-file pyproject.toml octoprobe || true + +python -m pylint octoprobe || true