Skip to content

Commit 367d581

Browse files
committed
make .github/workflows/test.yml reusable via workflow_call trigger and call it from .github/workflows/release.yml
test.yml uses pytest-split with 10 concurrent jobs, so much faster than release.yml running all tests serially before
1 parent adf5af6 commit 367d581

File tree

2 files changed

+4
-73
lines changed

2 files changed

+4
-73
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -18,73 +18,8 @@ permissions:
1818

1919
jobs:
2020
test:
21-
strategy:
22-
fail-fast: false
23-
matrix:
24-
os: [ubuntu-latest]
25-
python-version: ["3.11"]
26-
27-
runs-on: ${{ matrix.os }}
28-
29-
env:
30-
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
31-
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
32-
PMG_TEST_FILES_DIR: ${{ github.workspace }}/tests/files
33-
GULP_LIB: ${{ github.workspace }}/cmd_line/gulp/Libraries
34-
PMG_VASP_PSP_DIR: ${{ github.workspace }}/tests/files
35-
36-
steps:
37-
- uses: actions/checkout@v4
38-
- name: Set up Python ${{ matrix.python-version }}
39-
uses: actions/setup-python@v5
40-
with:
41-
python-version: ${{ matrix.python-version }}
42-
cache: pip
43-
cache-dependency-path: setup.py
44-
- name: Copy GULP to bin
45-
if: matrix.os == 'ubuntu-latest'
46-
run: |
47-
sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
48-
- name: Install Bader
49-
if: matrix.os == 'ubuntu-latest'
50-
run: |
51-
wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
52-
tar xvzf bader_lnx_64.tar.gz
53-
sudo mv bader /usr/local/bin/
54-
continue-on-error: true # This is not critical to succeed.
55-
- name: Install Enumlib
56-
if: matrix.os == 'ubuntu-latest'
57-
run: |
58-
git clone --recursive https://github.com/msg-byu/enumlib.git
59-
cd enumlib/symlib/src
60-
export F90=gfortran
61-
make
62-
cd ../../src
63-
make enum.x
64-
sudo mv enum.x /usr/local/bin/
65-
cd ..
66-
sudo cp aux_src/makeStr.py /usr/local/bin/
67-
continue-on-error: true # This is not critical to succeed.
68-
- name: Install dependencies
69-
run: |
70-
python -m pip install --upgrade pip wheel
71-
72-
# TODO remove next line installing ase from main branch until FrechetCellFilter is released
73-
pip install git+https://gitlab.com/ase/ase
74-
75-
python -m pip install numpy cython
76-
python -m pip install -e '.[dev,optional]'
77-
- name: pytest
78-
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
79-
run: |
80-
rm -rf .coverage* coverage*
81-
pytest --cov=pymatgen tests
82-
- name: Upload coverage reports to Codecov
83-
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
84-
uses: codecov/codecov-action@v3
85-
with:
86-
token: ${{ secrets.CODECOV_TOKEN }}
87-
verbose: true
21+
# run test.yml first to ensure that the test suite is passing
22+
uses: ./.github/workflows/test.yml
8823

8924
build_sdist:
9025
needs: test

.github/workflows/test.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ on:
1010
branches: [master]
1111
paths-ignore: ["**/*.md", docs/**]
1212
workflow_dispatch:
13-
inputs:
14-
task:
15-
type: choice
16-
options: [tests, release]
17-
default: tests
18-
description: Only run tests or release a new version of pymatgen to PyPI after tests pass.
13+
# make this workflow reusable by release.yml
14+
workflow_call:
1915

2016
permissions:
2117
contents: read

0 commit comments

Comments
 (0)