Skip to content

Speed up build

Speed up build #544

Workflow file for this run

name: Python package
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types:
- published
# Newer commits should cancel old runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check -v"
src: "python/neml2 python/tests"
test:
needs: black
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
btype: [Release, Debug]
runs-on: ${{ matrix.os }}
steps:
- uses: applied-material-modeling/neml2-ci@main
with:
python-version: 3.9
cmake-version: 3.28
torch-version: 2.5.1
- name: Configure
run: cmake --preset dev -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.btype }} -S .
- name: Build
run: cmake --build --preset dev-python
- name: Run tests
run: PYTHONPATH=build/dev/python pytest -vv --junitxml=pytest.xml python/tests
- name: Test results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: always()
with:
files: pytest.xml
check_name: Test Results
check_run: false
action_fail: true
comment_mode: off
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- name: Upload SDist
uses: actions/upload-artifact@v4
if: github.event_name == 'release' && github.event.action == 'published'
with:
name: package-sdist
path: dist/*.tar.gz
PyPI:
needs: sdist
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: package-sdist
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1