From 367d581b11cfe4b063f6b33e56808716d83373e2 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Thu, 1 Feb 2024 15:16:43 +0100 Subject: [PATCH] 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 --- .github/workflows/release.yml | 69 +---------------------------------- .github/workflows/test.yml | 8 +--- 2 files changed, 4 insertions(+), 73 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67e1af22664..c2b5eb29754 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9cb6a17465b..a0880ed80df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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