Skip to content

Commit

Permalink
first try at additional test of only main dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
stringertheory committed Feb 5, 2024
1 parent b764b4b commit 69650d8
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/actions/setup-poetry-env-only-main/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "setup-poetry-env"
description: "Composite action to setup the Python and poetry environment."

inputs:
python-version:
required: false
description: "The python version to use"
default: "3.12"

runs:
using: "composite"
steps:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --only main
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/setup-poetry-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
python-version:
required: false
description: "The python version to use"
default: "3.11"
default: "3.12"

runs:
using: "composite"
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- dev
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

Expand All @@ -25,6 +26,18 @@ jobs:
- name: Run checks
run: make check

tests-only-main-dependencies:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3

- name: Set up the environment
uses: ./.github/actions/setup-poetry-env-only-main

- name: Check if documentation can be built
run: make test-only-main

tox:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -57,7 +70,7 @@ jobs:
- name: Test with tox
run: tox

- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.12
uses: codecov/codecov-action@v3
if: ${{ matrix.python-version == '3.12' }}

Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
install: ## Install the poetry environment and install the pre-commit hooks
@echo "🚀 Creating virtual environment using pyenv and poetry"
@poetry install
@ poetry run pre-commit install
@poetry run pre-commit install
@poetry shell

.PHONY: check
Expand All @@ -21,6 +21,11 @@ test: ## Test the code with pytest
@echo "🚀 Testing code: Running pytest"
@poetry run pytest --cov --cov-config=pyproject.toml --cov-report=xml

.PHONY: test-only-main
test-only-main: ## Test the code with pytest
@echo "🚀 Testing code: Running pytest with only main dependencies"
@poetry run pytest $$(ls tests/*.py | grep -v external)

.PHONY: build
build: clean-build ## Build wheel file using poetry
@echo "🚀 Creating wheel file"
Expand Down

0 comments on commit 69650d8

Please sign in to comment.