From ac3e7f7075e176f001f798d44d2bb6df71fbdb86 Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Fri, 16 May 2025 14:57:50 -0500 Subject: [PATCH 1/6] add Github Actions to install and run tests --- .github/workflows/test-ubuntu.yml | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/test-ubuntu.yml diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml new file mode 100644 index 0000000..30b114c --- /dev/null +++ b/.github/workflows/test-ubuntu.yml @@ -0,0 +1,48 @@ +name: Test with Ubuntu + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + fail-fast: false + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y xvfb + - name: Set up Python from Miniconda/conda + uses: conda-incubator/setup-miniconda@v2.2.0 + with: + miniconda-version: latest + channels: conda-forge,defaults + channel-priority: true + activate-environment: anaconda-client-env + python-version: ${{ matrix.python-version }} + - name: Install conda dependencies + run: | + printenv + conda install -y -c conda-forge python=${{ matrix.python-version }} "numpy>=1.26" "scipy>=1.14" pytest pytest-cov coverage + - name: Install larixite and dependencies with pip + run: | + pip install ".[dev,test,doc]" + - name: Run test suite + run: | + cd tests + python -m pytest --cov=./ --cov-report=xml From 82e9dac059696f91c78faf71c448a4a89adf2b4a Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Fri, 16 May 2025 14:58:32 -0500 Subject: [PATCH 2/6] fix test_struct.py to run from top-level or tests folder --- tests/test_struct.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_struct.py b/tests/test_struct.py index a7a7d78..6031cce 100644 --- a/tests/test_struct.py +++ b/tests/test_struct.py @@ -3,8 +3,8 @@ from larixite.utils import get_logger logger = get_logger("larixite.test") -testdir = Path().cwd() / "tests" -structsdir = testdir / "structs" + +structsdir = Path(__file__).parent / "structs" test_structures = ( # filename_in_structsdir, absorber_str, absorber_index, occupancy ("CuO6_D4h.xyz", "Cu", 0, 1), From c400ba0b73fe5b50da26336565210d24775d0181 Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Fri, 16 May 2025 15:03:22 -0500 Subject: [PATCH 3/6] fix action script --- .github/workflows/test-ubuntu.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index 30b114c..4601c66 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -19,14 +19,6 @@ jobs: shell: bash -l {0} steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y xvfb - name: Set up Python from Miniconda/conda uses: conda-incubator/setup-miniconda@v2.2.0 with: From a5d1142aa551dedb31c2151636564a23d17bf3e1 Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Fri, 16 May 2025 15:04:25 -0500 Subject: [PATCH 4/6] another indent fix for action script --- .github/workflows/test-ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index 4601c66..bbf74b4 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -36,5 +36,5 @@ jobs: pip install ".[dev,test,doc]" - name: Run test suite run: | - cd tests - python -m pytest --cov=./ --cov-report=xml + cd tests + python -m pytest --cov=./ --cov-report=xml From 77e8ddc30311065acd3493a90665f0f8c549bea2 Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Fri, 16 May 2025 15:07:53 -0500 Subject: [PATCH 5/6] do not specify scipy version in ci action script --- .github/workflows/test-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index bbf74b4..e1f9153 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -30,7 +30,7 @@ jobs: - name: Install conda dependencies run: | printenv - conda install -y -c conda-forge python=${{ matrix.python-version }} "numpy>=1.26" "scipy>=1.14" pytest pytest-cov coverage + conda install -y -c conda-forge python=${{ matrix.python-version }} "numpy>=1.26" scipy pytest pytest-cov coverage - name: Install larixite and dependencies with pip run: | pip install ".[dev,test,doc]" From 2009196cd5e280f6fb488c65e9c198748aa7e60d Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Fri, 16 May 2025 15:10:54 -0500 Subject: [PATCH 6/6] do not run ci tests with Python 3.9 --- .github/workflows/test-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index e1f9153..cc40abd 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -13,7 +13,7 @@ jobs: max-parallel: 5 fail-fast: false matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13'] defaults: run: shell: bash -l {0}