Skip to content

Commit

Permalink
Add workflow for testing in bare environment
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Jul 23, 2024
1 parent 164789f commit ba8cb12
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 56 deletions.
37 changes: 37 additions & 0 deletions .github/actions/init-bare-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Init Environment"
description: "Initialize bare environment for tests"
runs:
using: "composite"
steps:
- name: Checkout actions
uses: actions/checkout@v3

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

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

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

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with test --with dev
shell: bash

- name: Activate venv
run: |
source $VENV
echo PATH=$PATH >> $GITHUB_ENV
shell: bash
13 changes: 13 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ jobs:
uses: ./.github/actions/init-environment
- name: Run unit tests
run: make test/unit
test-bare:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Init environment
uses: ./.github/actions/init-bare-environment
- name: Run unit tests
run: poetry run pytest -n auto tests/unit/structures
test-windows:
runs-on: windows-latest
strategy:
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,24 @@ publish: ## Push git tag and publish version to PyPI.

.PHONY: install
install: ## Install all dependencies.
@make install/all

.PHONY: install/core
install/core: ## Install core dependencies.
@poetry install

.PHONY: install/all
install/all: ## Install all dependencies.
@poetry install --with dev --with test --with docs --all-extras

.PHONY: install/dev
install/dev: ## Install dev dependencies.
@poetry install --with dev

.PHONY: install/test
install/test: ## Install test dependencies.
@poetry install --with test

.PHONY: test ## Run all tests.
test: test/unit test/integration

Expand Down
101 changes: 45 additions & 56 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba8cb12

Please sign in to comment.