Skip to content

Commit

Permalink
make .github/workflows/test.yml reusable via workflow_call trigger an…
Browse files Browse the repository at this point in the history
…d 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
  • Loading branch information
janosh committed Feb 1, 2024
1 parent adf5af6 commit 367d581
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 73 deletions.
69 changes: 2 additions & 67 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,73 +18,8 @@ permissions:

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]

runs-on: ${{ matrix.os }}

env:
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
PMG_TEST_FILES_DIR: ${{ github.workspace }}/tests/files
GULP_LIB: ${{ github.workspace }}/cmd_line/gulp/Libraries
PMG_VASP_PSP_DIR: ${{ github.workspace }}/tests/files

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: setup.py
- name: Copy GULP to bin
if: matrix.os == 'ubuntu-latest'
run: |
sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
- name: Install Bader
if: matrix.os == 'ubuntu-latest'
run: |
wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
tar xvzf bader_lnx_64.tar.gz
sudo mv bader /usr/local/bin/
continue-on-error: true # This is not critical to succeed.
- name: Install Enumlib
if: matrix.os == 'ubuntu-latest'
run: |
git clone --recursive https://github.com/msg-byu/enumlib.git
cd enumlib/symlib/src
export F90=gfortran
make
cd ../../src
make enum.x
sudo mv enum.x /usr/local/bin/
cd ..
sudo cp aux_src/makeStr.py /usr/local/bin/
continue-on-error: true # This is not critical to succeed.
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
# TODO remove next line installing ase from main branch until FrechetCellFilter is released
pip install git+https://gitlab.com/ase/ase
python -m pip install numpy cython
python -m pip install -e '.[dev,optional]'
- name: pytest
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
run: |
rm -rf .coverage* coverage*
pytest --cov=pymatgen tests
- name: Upload coverage reports to Codecov
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
# run test.yml first to ensure that the test suite is passing
uses: ./.github/workflows/test.yml

build_sdist:
needs: test
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ on:
branches: [master]
paths-ignore: ["**/*.md", docs/**]
workflow_dispatch:
inputs:
task:
type: choice
options: [tests, release]
default: tests
description: Only run tests or release a new version of pymatgen to PyPI after tests pass.
# make this workflow reusable by release.yml
workflow_call:

permissions:
contents: read
Expand Down

0 comments on commit 367d581

Please sign in to comment.