Skip to content

Update scikit-build-core, best practices #107

Update scikit-build-core, best practices

Update scikit-build-core, best practices #107

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
with:
extra_args: --hook-stage manual --all-files
# pylint is so noisy that there's no way the CI will ever pass if it's enabled.
# It's good to run when I think of it, but better to be a bit practical too. So I've disabled it for now
#- name: Run PyLint
# run: |
# echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
# pipx run nox -s pylint
checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
needs: [pre-commit]
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.12"]
#runs-on: [ubuntu-latest, macos-latest]
runs-on: [ubuntu-latest]
# As of Feb 2024, skip due to compiled code
#include:
# - python-version: pypy-3.10
# runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
# Build mammoth-cpp (adapted from awkward-cpp)
# First, we want a cache for fastjet builds
- name: Cache fastjet build arifacts
id: cache-fastjet-build
uses: actions/cache@v4
with:
path: ./mammoth-cpp/external/install/fastjet
#key: ${{ github.job }}-${{ hashFiles('mammoth-cpp/src/**') }}
# NOTE: We embed fastjet version. Ideally, we could configure this
# from one place, but it's not obvious the best way to do this
# at the moment, so we'll just work with this.
key: ${{ github.job }}-${{ runner.os }}-fastjet-3.4.1_1.051
- name: Build fastjet
if: steps.cache-fastjet-build.outputs.cache-hit != 'true'
run: ./mammoth-cpp/external/install_fastjet.sh
# We also want a cache for mammoth-cpp wheels
- name: Cache mammoth-cpp wheel
id: cache-mammoth-cpp-wheel
uses: actions/cache@v4
with:
path: ./mammoth-cpp/dist
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.python-version }}-m-cpp-wheel-${{ hashFiles('mammoth-cpp/**') }}
# Finally, build and install mammoth-cpp
- name: Build mammoth-cpp wheel
if: steps.cache-mammoth-cpp-wheel.outputs.cache-hit != 'true'
run: |
python -m pip install build
python -m build -w ./mammoth-cpp
ls ./mammoth-cpp/dist
- name: Install mammoth-cpp
run: python -m pip install -v ./mammoth-cpp/dist/*.whl
# Finally, install mammoth
- name: Install package
run: python -m pip install .[test]
- name: Test package
run: >-
python -m pytest -ra --cov --cov-report=xml --cov-report=term
--durations=20
#- name: Upload coverage report
# uses: codecov/[email protected]