Merge pull request #380 from gaiaresources/BDRSPS-1144-resusable-sites #552
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Testing | |
on: | |
push: | |
branches: | |
- main | |
- 'release/**' | |
pull_request: | |
branches: | |
- main | |
- 'release/**' | |
env: | |
PYTHON_VERSION: "3.11" | |
POETRY_VERSION: "1.8.5" | |
jobs: | |
poetry-lock: | |
# Job to check poetry lock file is present, up-to-date with pyproject.toml, | |
# and a valid resolution of the dependencies. | |
runs-on: ubuntu-latest | |
steps: | |
# Setup steps | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
run: pipx install poetry==${{ env.POETRY_VERSION }} --python=${{ env.PYTHON_VERSION }} | |
# Do checks | |
- run: poetry check | |
- run: poetry check --lock | |
- name: Check dependencies can be resolved | |
run: poetry lock --no-update | |
- name: Check resolving dependencies did not change the lock file | |
run: | | |
echo "Checking if locking dependencies has created any diff in the lock file..." | |
if | |
git diff --exit-code -- poetry.lock | |
then | |
echo "No changes to poetry.lock detected" | |
else | |
echo "Changes to poetry.lock detected!" | |
echo "You probably should run 'poetry lock --no-update' and add the result to your PR" | |
exit 1 | |
fi | |
model-docs: | |
# Job to check that update to models' documentation is not required | |
needs: [poetry-lock] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-python-and-dependencies | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- run: poetry run poe generate-model-docs | |
- name: Check model changes left undocumented | |
run: | | |
echo "Checking if model changes left undocumented" | |
if | |
git diff --exit-code -- docs/* > /dev/null | |
then | |
echo "No model changes detected" | |
else | |
echo "There was an undocumented change in models detected" | |
echo "Make necessary changes and commit them (e.g. run 'poe generate-model-docs')" | |
exit 1 | |
fi | |
format: | |
needs: [poetry-lock] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-python-and-dependencies | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- run: poetry run poe format-check | |
lint: | |
needs: [poetry-lock] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-python-and-dependencies | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- run: poetry run poe lint | |
lint-imports: | |
needs: [ poetry-lock ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-python-and-dependencies | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- run: poetry run poe lint-imports | |
mypy: | |
needs: [poetry-lock] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-python-and-dependencies | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- run: poetry run poe typecheck | |
pytest: | |
needs: [poetry-lock] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-python-and-dependencies | |
with: | |
python-version: ${{ matrix.python-version }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- run: poetry run poe test |