Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of Poetry parametrized #26

Closed
wants to merge 11 commits into from
44 changes: 40 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,29 @@ on:
push:
branches:
- master
- main
- poetry
pull_request:
branches:
- master
- main
- poetry

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
poetry:
type: boolean
description: "Use Poetry-based workflow."
required: false

# Allow this workflow to be called from other repositories.
workflow_call:
inputs:
poetry:
type: boolean
description: "Use Poetry-based workflow."
required: false

jobs:
run-tests:
Expand All @@ -32,18 +46,40 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: abatilo/actions-poetry@v2
if: ${{ inputs.poetry || github.event_name == 'push' || github.event_name == 'pull_request' }}
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.7.1"
poetry-version: "1.8.3"

- name: Install dependencies
- name: Install dependencies with Poetry
if: ${{ inputs.poetry || github.event_name == 'push' || github.event_name == 'pull_request' }}
run: |
poetry install --with test --all-extras
poetry add git+https://github.com/AstarVienna/ScopeSim_Data.git

- name: Run Pytest
- name: Run Pytest with Poetry
if: ${{ inputs.poetry || github.event_name == 'push' || github.event_name == 'pull_request' }}
run: poetry run pytest -m "not webtest" --cov --cov-report=xml

- name: Install dependencies without Poetry
if: ${{ ! inputs.poetry && github.event_name != 'push' && github.event_name != 'pull_request' }}
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/AstarVienna/ScopeSim_Data.git
# Install this clone of the project. This is relevant because for
# example ScopeSim has ScopeSim_Templates as a test-dependency
# and that package has ScopeSim as a dependency. So the PyPI version
# of ScopeSim would be installed without the "pip install ." line.
pip install .
# TODO: It should not be necessary to install the dev dependencies.
# Perhaps create a separate test for that?
pip install .[test,dev]
pip install pytest pytest-cov

- name: Run Pytest without Poetry
if: ${{ ! inputs.poetry && github.event_name != 'push' && github.event_name != 'pull_request' }}
run: pytest -m "not webtest" --cov --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/updated_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ on:
push:
branches:
- master
- main
- poetry
pull_request:
branches:
- master
- main
- poetry

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allow this workflow to be called from other repositories.
workflow_call:

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

jobs:
run-tests:
name: ${{ matrix.os }}, ${{ matrix.python-version }}
Expand All @@ -27,14 +33,14 @@ jobs:
- uses: actions/checkout@v4

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

- name: Set up Poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.7.1"
poetry-version: "1.8.3"

- name: Install dependencies
run: |
Expand Down
51 changes: 38 additions & 13 deletions .github/workflows/webtests.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
poetry:
type: boolean
description: "Use Poetry-based workflow."
required: false

# Allow this workflow to be called from other repositories.
workflow_call:
inputs:
poetry:
type: boolean
description: "Use Poetry-based workflow."
required: false

jobs:
run-tests:
Expand All @@ -28,24 +31,46 @@ jobs:
- uses: actions/checkout@v4

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

- name: Set up Poetry
uses: abatilo/actions-poetry@v2
if: inputs.poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.7.1"
poetry-version: "1.8.3"

- name: Install dependencies
- name: Install dependencies with Poetry
if: inputs.poetry
run: |
poetry install --with test --all-extras
poetry add git+https://github.com/AstarVienna/ScopeSim_Data.git

- name: Run Pytest
- name: Run Pytest with Poetry
if: inputs.poetry
run: poetry run pytest -m "webtest" --cov --cov-report=xml

- name: Install dependencies without Poetry
if: ${{ ! inputs.poetry }}
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/AstarVienna/ScopeSim_Data.git
# Install this clone of the project. This is relevant because for
# example ScopeSim has ScopeSim_Templates as a test-dependency
# and that package has ScopeSim as a dependency. So the PyPI version
# of ScopeSim would be installed without the "pip install ." line.
pip install .
# TODO: It should not be necessary to install the dev dependencies.
# Perhaps create a separate test for that?
pip install .[test,dev]
pip install pytest pytest-cov

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

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}