Skip to content

Commit

Permalink
Initial gitlab workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaerki committed Jun 30, 2024
1 parent 0322ec2 commit c3a8771
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
28 changes: 9 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Test

on:
push:
branches:
- master
workflow_dispatch:
# branches:
# - master
pull_request:
types:
- opened
Expand All @@ -12,6 +13,7 @@ on:
# cron every week on monday
- cron: "0 0 * * 1"


jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -24,20 +26,18 @@ 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
- uses: actions/cache@v4
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

Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c3a8771

Please sign in to comment.