From e0b0e5da9828be0ca523b9d7c6d64dd970e43bb5 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 6 Oct 2023 16:19:13 +0200 Subject: [PATCH 1/4] added nanobind to test suite --- .github/workflows/nanobind.yml | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/nanobind.yml diff --git a/.github/workflows/nanobind.yml b/.github/workflows/nanobind.yml new file mode 100644 index 0000000..5e06544 --- /dev/null +++ b/.github/workflows/nanobind.yml @@ -0,0 +1,90 @@ +name: nanobind + +on: + workflow_dispatch: + pull_request: + branches: [ main ] + paths: + - '.github/workflows/nanobind.yml' + + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + - cron: "0 2 * * 0" + +concurrency: + group: test-${{ github.ref }} + cancel-in-progress: true + +env: + PIP_ONLY_BINARY: numpy + FORCE_COLOR: 3 + PYTEST_TIMEOUT: 300 + +jobs: + # This is the "main" test suite, which tests a large number of different + # versions of default compilers and Python versions in GitHub Actions. + standard: + strategy: + fail-fast: false + matrix: + runs-on: [ubuntu-latest, windows-2022, macos-latest] + python: + - 'pypy-3.10-nightly' + - 'pypy-3.9-nightly' + + # Items in here will either be added to the build matrix (if not + # present), or add new keys to an existing matrix element if all the + # existing keys match. + # + # We support an optional key: args, for cmake args + include: + - runs-on: ubuntu-latest + python: 'pypy-3.9-nightly' + + name: "nanobind ${{ matrix.python }} • ${{ matrix.runs-on }} x64 ${{ matrix.args }}" + runs-on: ${{ matrix.runs-on }} + + steps: + - uses: actions/checkout@v3 + with: + repository: wjakob/nanobind + + - name: Setup Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Update CMake + uses: jwlawson/actions-setup-cmake@v1.13 + + - name: Cache wheels + if: runner.os == 'macOS' + uses: actions/cache@v3 + with: + # This path is specific to macOS - we really only need it for PyPy NumPy wheels + # See https://github.com/actions/cache/blob/master/examples.md#python---pip + # for ways to do this more generally + path: ~/Library/Caches/pip + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-pip-${{ matrix.python }}-x64-${{ hashFiles('tests/requirements.txt') }} + + - name: Setup annotations on Linux + if: runner.os == 'Linux' + run: python -m pip install pytest-github-actions-annotate-failures + + # First build - C++11 mode and inplace + - name: Configure C++11 ${{ matrix.args }} + run: > + cmake -S . -B . + ${{ matrix.args }} + + - name: Build + run: cmake --build . -j 2 + + - name: Test + run: python -m pytest From 21f59da02ec5a5f09a73a0f9fc9787ab4e89bd4e Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 6 Oct 2023 16:29:07 +0200 Subject: [PATCH 2/4] checkout submodules, removed NumPy-related part --- .github/workflows/nanobind.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/nanobind.yml b/.github/workflows/nanobind.yml index 5e06544..7e8d695 100644 --- a/.github/workflows/nanobind.yml +++ b/.github/workflows/nanobind.yml @@ -53,6 +53,7 @@ jobs: - uses: actions/checkout@v3 with: repository: wjakob/nanobind + submodules: recursive - name: Setup Python ${{ matrix.python }} uses: actions/setup-python@v4 @@ -62,17 +63,6 @@ jobs: - name: Update CMake uses: jwlawson/actions-setup-cmake@v1.13 - - name: Cache wheels - if: runner.os == 'macOS' - uses: actions/cache@v3 - with: - # This path is specific to macOS - we really only need it for PyPy NumPy wheels - # See https://github.com/actions/cache/blob/master/examples.md#python---pip - # for ways to do this more generally - path: ~/Library/Caches/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ matrix.python }}-x64-${{ hashFiles('tests/requirements.txt') }} - - name: Setup annotations on Linux if: runner.os == 'Linux' run: python -m pip install pytest-github-actions-annotate-failures From d4d326c6644a89b76d60b1e087d5ecb6bffe7abc Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 6 Oct 2023 17:09:56 +0200 Subject: [PATCH 3/4] minor cleanups, install pytest everywhere --- .github/workflows/nanobind.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nanobind.yml b/.github/workflows/nanobind.yml index 7e8d695..cbd7ef6 100644 --- a/.github/workflows/nanobind.yml +++ b/.github/workflows/nanobind.yml @@ -63,15 +63,16 @@ jobs: - name: Update CMake uses: jwlawson/actions-setup-cmake@v1.13 + - name: Install pytest + run: python -m pip install pytest + - name: Setup annotations on Linux if: runner.os == 'Linux' run: python -m pip install pytest-github-actions-annotate-failures - # First build - C++11 mode and inplace - - name: Configure C++11 ${{ matrix.args }} + - name: Configure ${{ matrix.args }} run: > - cmake -S . -B . - ${{ matrix.args }} + cmake -S . -B . ${{ matrix.args }} - name: Build run: cmake --build . -j 2 From 95d1fa1bdbd954dad172267015740b2bf6541056 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 6 Oct 2023 18:26:43 +0200 Subject: [PATCH 4/4] use build directory --- .github/workflows/nanobind.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nanobind.yml b/.github/workflows/nanobind.yml index cbd7ef6..a6bc959 100644 --- a/.github/workflows/nanobind.yml +++ b/.github/workflows/nanobind.yml @@ -72,10 +72,12 @@ jobs: - name: Configure ${{ matrix.args }} run: > - cmake -S . -B . ${{ matrix.args }} + cmake -S . -B build ${{ matrix.args }} - name: Build - run: cmake --build . -j 2 + run: cmake --build build -j 2 - - name: Test - run: python -m pytest + - name: Run tests + run: > + cd build; + python -m pytest