Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ on:
description: "Use Poetry-based workflow."
required: false
default: true
trigger:
type: string
description: "Fake input parameter to tell if triggered from outside. Do not set manually."
required: false
default: "external"

jobs:
run-tests:
Expand All @@ -38,29 +43,35 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Decide if poetry
id: decide
env:
USE_POETRY: "${{ (((github.event_name == 'pull_request') || (github.event_name == 'push')) && (inputs.trigger != 'external')) || ((inputs.poetry == true) && ((github.event_name == 'workflow_dispatch') || (inputs.trigger == 'external'))) }}"
run: echo "USE_POETRY=$USE_POETRY" >> "$GITHUB_OUTPUT"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
if: ${{ inputs.poetry }}
if: ${{ steps.decide.outputs.USE_POETRY == 'true' }}
uses: abatilo/actions-poetry@v3
with:
poetry-version: "2.1.3"

- name: Install dependencies with Poetry
if: ${{ inputs.poetry }}
if: ${{ steps.decide.outputs.USE_POETRY == 'true' }}
run: |
poetry install --with test --all-extras
poetry add git+https://github.com/AstarVienna/ScopeSim_Data.git

- name: Run Pytest with Poetry
if: ${{ inputs.poetry }}
if: ${{ steps.decide.outputs.USE_POETRY == 'true' }}
run: poetry run pytest -m "not webtest" --cov --cov-report=xml

- name: Install dependencies without Poetry
if: ${{ ! inputs.poetry }}
if: ${{ steps.decide.outputs.USE_POETRY == 'false' }}
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/AstarVienna/ScopeSim_Data.git
Expand All @@ -75,7 +86,7 @@ jobs:
pip install pytest pytest-cov

- name: Run Pytest without Poetry
if: ${{ ! inputs.poetry }}
if: ${{ steps.decide.outputs.USE_POETRY == 'false' }}
run: pytest -m "not webtest" --cov --cov-report=xml

- name: Upload coverage reports to Codecov
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/updated_tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Updated Tests
on:
push:
branches:
Expand All @@ -13,7 +13,7 @@ on:
# Allow this workflow to be called from other repositories.
workflow_call:

# This workflow need Poetry, so no flag is included.
# This workflow needs Poetry, so no flag is included.

jobs:
run-tests:
Expand Down
23 changes: 17 additions & 6 deletions .github/workflows/webtests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Webtests
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -15,6 +15,11 @@ on:
type: boolean
description: "Use Poetry-based workflow."
required: false
trigger:
type: string
description: "Fake input parameter to tell if triggered from outside. Do not set manually."
required: false
default: "external"

jobs:
run-tests:
Expand All @@ -30,29 +35,35 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Decide if poetry
id: decide
env:
USE_POETRY: "${{ (((github.event_name == 'pull_request') || (github.event_name == 'push')) && (inputs.trigger != 'external')) || ((inputs.poetry == true) && ((github.event_name == 'workflow_dispatch') || (inputs.trigger == 'external'))) }}"
run: echo "USE_POETRY=$USE_POETRY" >> "$GITHUB_OUTPUT"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
if: inputs.poetry
if: ${{ steps.decide.outputs.USE_POETRY == 'true' }}
uses: abatilo/actions-poetry@v3
with:
poetry-version: "2.1.3"

- name: Install dependencies with Poetry
if: inputs.poetry
if: ${{ steps.decide.outputs.USE_POETRY == 'true' }}
run: |
poetry install --with test --all-extras
poetry add git+https://github.com/AstarVienna/ScopeSim_Data.git

- name: Run Pytest with Poetry
if: inputs.poetry
if: ${{ steps.decide.outputs.USE_POETRY == 'true' }}
run: poetry run pytest -m "webtest" --cov --cov-report=xml

- name: Install dependencies without Poetry
if: ${{ ! inputs.poetry }}
if: ${{ steps.decide.outputs.USE_POETRY == 'false' }}
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/AstarVienna/ScopeSim_Data.git
Expand All @@ -67,7 +78,7 @@ jobs:
pip install pytest pytest-cov

- name: Run Pytest without Poetry
if: ${{ ! inputs.poetry }}
if: ${{ steps.decide.outputs.USE_POETRY == 'false' }}
run: pytest -m "webtest" --cov --cov-report=xml

- name: Upload coverage reports to Codecov
Expand Down
Loading