From 08c2fe1ffb0a6463ffb40951a3eb0950d4be0fc1 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Wed, 3 Apr 2024 12:50:46 +0000 Subject: [PATCH 1/4] Add testing infrastructure. --- tests/test_cube.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/test_cube.py diff --git a/tests/test_cube.py b/tests/test_cube.py new file mode 100644 index 0000000..b9f2f8a --- /dev/null +++ b/tests/test_cube.py @@ -0,0 +1,6 @@ +from cubehandler import Cube + + +def test_empty_cube(): + cube = Cube() + assert cube is not None From fe2be238c5329866c881396b8db607179ff935ac Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Wed, 3 Apr 2024 12:54:23 +0000 Subject: [PATCH 2/4] Add dev dependencies. --- pyproject.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8f544a0..9e76a8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,3 +21,11 @@ requires-python = ">=3.9" dependencies = [ "ase", ] + +[project.optional-dependencies] +dev = [ + "bumpver==2023.1129", + "pre-commit==3.6.0", + "pytest==7.4.4", + "pytest-cov==4.1.0", +] From 8e25b91f5d76aaecf5fbb7a31233c6a5695f5704 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Wed, 3 Apr 2024 12:54:56 +0000 Subject: [PATCH 3/4] Add test action. --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2c96875 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +--- +name: continuous-integration +on: [push, pull_request] + +jobs: + test-package: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package and its dependencies + run: python3 -m pip install -e .[dev] + + - name: Run pytest + run: pytest -v --cov --cov-report json From f12e01a861333eeb5795c87fa79a27f6eacee6e3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Wed, 3 Apr 2024 12:55:59 +0000 Subject: [PATCH 4/4] Don't run CI twise on pull requests. --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c96875..005e3a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ --- name: continuous-integration -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: jobs: test-package: