From 792d1ed93202acce9cfb10ced34aaca311ca3380 Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Tue, 1 Apr 2025 18:33:05 -0600 Subject: [PATCH 1/4] add spack action --- .github/workflows/spack.yml | 93 +++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/spack.yml diff --git a/.github/workflows/spack.yml b/.github/workflows/spack.yml new file mode 100644 index 0000000..6aea85a --- /dev/null +++ b/.github/workflows/spack.yml @@ -0,0 +1,93 @@ +name: Spack + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +permissions: + contents: read + actions: read + checks: write + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + + linux-ci: + name: Spack + + runs-on: ubuntu-latest + timeout-minutes: 600 + env: + MPIEXEC_FLAGS: "--allow-run-as-root --oversubscribe" + OMPI_CC: ${{ matrix.c-compiler }} + OMPI_CXX: ${{ matrix.cxx-compiler }} + OMP_NUM_THREADS: 1 + + steps: + - name: Harden Runner + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 + with: + egress-policy: audit + + - name: Pull ccache cache + if: always() + id: ccache-restore + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: /home/runner/.cache/ccache + key: ccache-spack + + - name: Install Ubuntu packages + if: always() + run: | + sudo apt-get update + sudo apt-get install -yq ccache bzip2 ca-certificates g++ gcc gfortran git gzip lsb-release patch python3 tar unzip xz-utils zstd + + - name: Get ccache config dir + if: always() + run: ccache --show-config + + - name: Clone spack + if: always() + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: spack/spack + path: spack + + - name: Install + if: always() + run: | + source spack/share/spack/setup-env.sh + spack config add config:ccache:true + spack env create pynucleus + spack env activate pynucleus + spack add py-pynucleus + spack concretize + spack install + + - name: Remove ccache cache + if: ${{ steps.ccache-restore.outputs.cache-hit }} + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + gh extension install actions/gh-actions-cache + gh actions-cache delete ccache-spack --confirm + continue-on-error: true + + - name: Push ccache cache + if: always() + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: /home/runner/.cache/ccache + key: ccache-spack + + - name: Ccache report + if: always() + run: ccache -s From 623d2a4f22910062b614644993a80f5e26577b5e Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Tue, 1 Apr 2025 18:33:15 -0600 Subject: [PATCH 2/4] DO NOT MERGE --- .github/workflows/build.yml | 268 ------------------------- .github/workflows/container.yml | 167 --------------- .github/workflows/documentation-ci.yml | 79 -------- .github/workflows/documentation.yml | 87 -------- 4 files changed, 601 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/container.yml delete mode 100644 .github/workflows/documentation-ci.yml delete mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c10bec0..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,268 +0,0 @@ -name: CI - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - workflow_dispatch: - -permissions: - contents: read - actions: read - checks: write - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - - linux-ci: - strategy: - matrix: - include: - - py-version: '3.10' - c-compiler: 'gcc' - cxx-compiler: 'g++' - - py-version: '3.11' - c-compiler: 'gcc' - cxx-compiler: 'g++' - - py-version: '3.12' - c-compiler: 'gcc' - cxx-compiler: 'g++' - - py-version: '3.10' - c-compiler: 'clang' - cxx-compiler: 'clang++' - fail-fast: false - name: Linux ${{ matrix.c-compiler}} Python ${{ matrix.py-version }} - - - runs-on: ubuntu-latest - timeout-minutes: 180 - env: - MPIEXEC_FLAGS: "--allow-run-as-root --oversubscribe" - PYNUCLEUS_BUILD_PARALLELISM: 2 - OMPI_CC: ${{ matrix.c-compiler }} - OMPI_CXX: ${{ matrix.cxx-compiler }} - BUILD_PRETTY_IDENTIFIER: "Linux ${{ matrix.c-compiler }} Python ${{ matrix.py-version }}" - BUILD_IDENTIFIER: "Linux-${{ matrix.c-compiler }}-${{ matrix.py-version }}" - OMP_NUM_THREADS: 1 - - steps: - - name: Harden Runner - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 - with: - egress-policy: audit - - - name: Check out repo - if: always() - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Pull ccache cache - if: always() - id: ccache-restore - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /home/runner/.cache/ccache - key: ccache-${{ env.BUILD_IDENTIFIER }} - - - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 - if: always() - with: - python-version: ${{ matrix.py-version }} - - - name: Install Ubuntu packages - if: always() - run: | - sudo apt-get update - sudo apt-get install -yq mpi-default-bin mpi-default-dev libmetis-dev libparmetis-dev libsuitesparse-dev ccache - - - name: Get ccache config dir - if: always() - run: ccache --show-config - - - name: Install Python dependencies - if: always() - run: make prereq && make prereq-extra - - - name: Install - if: always() - run: python -m pip list && make install PIP_INSTALL_FLAGS="--no-use-pep517 -vvv" - - - name: Remove ccache cache - if: ${{ steps.ccache-restore.outputs.cache-hit }} - shell: bash - env: - GH_TOKEN: ${{ github.token }} - run: | - gh extension install actions/gh-actions-cache - gh actions-cache delete ccache-${{ env.BUILD_IDENTIFIER }} --confirm - continue-on-error: true - - - name: Push ccache cache - if: always() - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /home/runner/.cache/ccache - key: ccache-${{ env.BUILD_IDENTIFIER }} - - - name: Ccache report - if: always() - run: ccache -s - - - name: Run tests - if: always() - run: python3 -m pytest --junit-xml=test-results-${{ env.BUILD_IDENTIFIER }}.xml tests/ - - - name: Run flake8 - if: always() - run: | - make flake8 - mv flake8.xml flake8-${{ env.BUILD_IDENTIFIER }}.xml - - - name: Run cython-lint - if: always() - run: | - make cython-lint - mv cython-lint.xml cython-lint-${{ env.BUILD_IDENTIFIER }}.xml - - - name: Archive results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: always() - with: - name: Results (${{ env.BUILD_PRETTY_IDENTIFIER }}) - path: | - test-results-${{ env.BUILD_IDENTIFIER }}.xml - flake8-${{ env.BUILD_IDENTIFIER }}.xml - cython-lint-${{ env.BUILD_IDENTIFIER }}.xml - - - name: Report results - uses: dorny/test-reporter@6e6a65b7a0bd2c9197df7d0ae36ac5cee784230c # v1 - if: always() - with: - name: Report (${{ env.BUILD_PRETTY_IDENTIFIER }}) - path: | - *-${{ env.BUILD_IDENTIFIER }}.xml - reporter: java-junit - fail-on-error: false - - mac-ci: - - strategy: - matrix: - py-version: ['3.10'] - fail-fast: false - name: Mac clang Python ${{ matrix.py-version }} - - runs-on: macos-13 - timeout-minutes: 180 - env: - MPIEXEC_FLAGS: "--allow-run-as-root --oversubscribe" - PYNUCLEUS_BUILD_PARALLELISM: 3 - SUITESPARSE_INCLUDE_DIR: /usr/local/Cellar/brewsci-suite-sparse/4.5.5_2/include - SUITESPARSE_LIBRARY_DIR: /usr/local/Cellar/brewsci-suite-sparse/4.5.5_2/lib - LDFLAGS: -L/usr/local/opt/brewsci-metis/lib -L/usr/local/opt/brewsci-parmetis/lib - CPPFLAGS: -I/usr/local/opt/brewsci-metis/include -I/usr/local/opt/brewsci-parmetis/include - OMP_NUM_THREADS: 1 - - steps: - - name: Harden Runner - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 - with: - egress-policy: audit - - - name: Check out repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Pull ccache cache - if: always() - id: ccache-restore - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /Users/runner/Library/Caches/ccache - key: ccache-${{ runner.os }}-${{ matrix.py-version }} - - - name: Setup GNU Fortran - uses: fortran-lang/setup-fortran@2bbdcb313d2b7e72d1d07caf87f3ef9f376d9224 # v1.6.3 - - - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 - with: - python-version: ${{ matrix.py-version }} - - - name: Install packages - run: | - brew install open-mpi ccache - brew tap brewsci/num - brew install brewsci-metis brewsci-parmetis brewsci-suite-sparse - - - name: Get ccache config dir - if: always() - run: ccache --show-config - - - name: Augment path - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Install Python dependencies - run: make prereq && make prereq-extra - - - name: Install - run: PIP_INSTALL_FLAGS=-vvv make install - - - name: Remove ccache cache - if: ${{ steps.ccache-restore.outputs.cache-hit }} - shell: bash - env: - GH_TOKEN: ${{ github.token }} - run: | - gh extension install actions/gh-actions-cache - gh actions-cache delete ccache-${{ runner.os }}-${{ matrix.py-version }} --confirm - continue-on-error: true - - - name: Push ccache cache - if: always() - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /Users/runner/Library/Caches/ccache - key: ccache-${{ runner.os }}-${{ matrix.py-version }} - - - name: Ccache report - if: always() - run: ccache -s - - - name: Run tests - if: always() - run: python3 -m pytest --junit-xml=test-results-${{ runner.os }}-${{ matrix.py-version }}.xml tests/ - - - name: Run flake8 - if: always() - run: | - make flake8 - mv flake8.xml flake8-${{ runner.os }}-${{ matrix.py-version }}.xml - - - name: Run cython-lint - if: always() - run: | - make cython-lint - mv cython-lint.xml cython-lint-${{ runner.os }}-${{ matrix.py-version }}.xml - - - name: Archive results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: always() - with: - name: Results ${{ github.job }} - path: | - test-results-${{ runner.os }}-${{ matrix.py-version }}.xml - flake8-${{ runner.os }}-${{ matrix.py-version }}.xml - cython-lint-${{ runner.os }}-${{ matrix.py-version }}.xml - - - name: Report results - uses: dorny/test-reporter@6e6a65b7a0bd2c9197df7d0ae36ac5cee784230c # v1 - if: always() - with: - name: Report (${{ github.job }}) - path: | - *-${{ runner.os }}-${{ matrix.py-version }}.xml - reporter: java-junit - fail-on-error: false diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml deleted file mode 100644 index 8e0ea3c..0000000 --- a/.github/workflows/container.yml +++ /dev/null @@ -1,167 +0,0 @@ -name: Container - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - IMAGE_NAME: pynucleus - IMAGE_TAGS: latest ${{ github.sha }} - TEST_IMAGE_TAG: ${{ github.sha }} - IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} - REGISTRY_USER: ${{ github.actor }} - REGISTRY_PASSWORD: ${{ github.token }} - -permissions: - contents: read - packages: write - -jobs: - - container: - runs-on: ubuntu-latest - timeout-minutes: 300 - - steps: - - name: Harden Runner - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 - with: - egress-policy: audit - - - name: Change image tags for PRs - if: github.event_name == 'pull_request' - run: | - echo "IMAGE_TAGS=pr-${{ github.event.number }}" >> $GITHUB_ENV - echo "TEST_IMAGE_TAG=pr-${{ github.event.number }}" >> $GITHUB_ENV - - - name: Check out - if: always() - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - # - uses: hadolint/hadolint-action@v3.1.0 - # with: - # dockerfile: Dockerfile - # ignore: 'DL3008,DL3013' - # verbose: true - - - name: Build Image - id: build_image - uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2.13 - with: - image: ${{ env.IMAGE_NAME }} - tags: ${{ env.IMAGE_TAGS }} - containerfiles: | - ./Dockerfile - build-args: | - PYNUCLEUS_BUILD_PARALLELISM=4 - - - name: Push To GHCR - if: (github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]') - uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8 - id: push-pr - with: - image: ${{ steps.build_image.outputs.image }} - tags: ${{ env.IMAGE_TAGS }} - registry: ${{ env.IMAGE_REGISTRY }} - username: ${{ env.REGISTRY_USER }} - password: ${{ env.REGISTRY_PASSWORD }} - extra-args: | - --disable-content-trust - - - name: Run tests - run: | - podman run \ - -e MPIEXEC_FLAGS="--allow-run-as-root --oversubscribe" \ - --workdir /pynucleus \ - --rm \ - --entrypoint='["python3", "-m", "pytest", "--junit-xml", "test-results.xml"]' \ - ${{ steps.build_image.outputs.image }}:${{ env.TEST_IMAGE_TAG }} - - - name: Push To GHCR - if: github.event_name == 'push' - uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8 - id: push - with: - image: ${{ steps.build_image.outputs.image }} - tags: ${{ steps.build_image.outputs.tags }} - registry: ${{ env.IMAGE_REGISTRY }} - username: ${{ env.REGISTRY_USER }} - password: ${{ env.REGISTRY_PASSWORD }} - extra-args: | - --disable-content-trust - - - name: Echo outputs - if: github.event_name == 'push' - run: | - echo "${{ toJSON(steps.push.outputs) }}" - - container-test: - needs: container - - strategy: - matrix: - include: - - runner: 'ubuntu-latest' - - name: Container test ${{ matrix.runner }} - runs-on: ${{ matrix.runner }} - - steps: - - name: Harden Runner - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 - with: - egress-policy: audit - - - name: Check out - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Install podman-compose - run: pip install podman-compose - - - name: Run container test - run: podman-compose run quick-test - - update-binder-image: - permissions: - contents: write # for peter-evans/create-pull-request to create branch - pull-requests: write # for peter-evans/create-pull-request to create a PR - needs: container - if: github.event_name == 'push' - - runs-on: ubuntu-latest - - steps: - - name: Harden Runner - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 - with: - egress-policy: audit - - - name: Checkout binder branch - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - ref: binder - - - name: Modify Dockerfile - run: | - python generateDockerfile.py ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TEST_IMAGE_TAG }} - - - name: Create PR - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Update Dockerfile" - title: "Update Dockerfile" - body: | - This PR updates the Dockerfile for binder. - branch: binder-update - base: binder - delete-branch: true diff --git a/.github/workflows/documentation-ci.yml b/.github/workflows/documentation-ci.yml deleted file mode 100644 index c366f5d..0000000 --- a/.github/workflows/documentation-ci.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Documentation CI - -on: - pull_request: - branches: [ "master" ] - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -permissions: - contents: read - id-token: write - -jobs: - - linux-ci-doc: - runs-on: ubuntu-latest - timeout-minutes: 180 - env: - MPIEXEC_FLAGS: "--allow-run-as-root --oversubscribe" - PYNUCLEUS_BUILD_PARALLELISM: 2 - - steps: - - name: Harden Runner - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 - with: - egress-policy: audit - - - name: Check out repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Pull ccache cache - id: ccache-restore - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /home/runner/.cache/ccache - key: ccache-documentation-ci - - - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 - with: - python-version: '3.11' - - - name: Install Ubuntu packages - run: | - sudo apt-get update - sudo apt-get install mpi-default-bin mpi-default-dev libmetis-dev libparmetis-dev libsuitesparse-dev ccache - - - name: Install Python dependencies - run: make prereq && make prereq-extra - - - name: Install - run: make dev - - - name: Remove ccache cache - if: ${{ steps.ccache-restore.outputs.cache-hit }} - shell: bash - env: - GH_TOKEN: ${{ github.token }} - run: | - gh extension install actions/gh-actions-cache - gh actions-cache delete ccache --confirm - continue-on-error: true - - - name: Push ccache cache - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /home/runner/.cache/ccache - key: ccache-documentation-ci - - - name: Build documentation - run: | - make docs - - - name: Upload artifact - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - path: 'docs/build' diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml deleted file mode 100644 index 9bfc1fc..0000000 --- a/.github/workflows/documentation.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Documentation - -on: - push: - branches: [ "master" ] - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -jobs: - - linux-doc: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - runs-on: ubuntu-latest - timeout-minutes: 180 - env: - MPIEXEC_FLAGS: "--allow-run-as-root --oversubscribe" - PYNUCLEUS_BUILD_PARALLELISM: 2 - - steps: - - name: Harden Runner - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 - with: - egress-policy: audit - - - name: Check out repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Pull ccache cache - id: ccache-restore - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /home/runner/.cache/ccache - key: ccache - - - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 - with: - python-version: '3.11' - - - name: Install Ubuntu packages - run: | - sudo apt-get update - sudo apt-get install mpi-default-bin mpi-default-dev libmetis-dev libparmetis-dev libsuitesparse-dev ccache - - - name: Install Python dependencies - run: make prereq && make prereq-extra - - - name: Install - run: make dev - - - name: Remove ccache cache - if: ${{ steps.ccache-restore.outputs.cache-hit }} - shell: bash - env: - GH_TOKEN: ${{ github.token }} - run: | - gh extension install actions/gh-actions-cache - gh actions-cache delete ccache --confirm - continue-on-error: true - - - name: Push ccache cache - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /home/runner/.cache/ccache - key: ccache - - - name: Build documentation - run: | - make docs - - - name: Setup Pages - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - - - name: Upload artifact - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 - with: - path: 'docs/build' - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 From cc7bd279baa344ad641bab0b984d1f73b6530b62 Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Tue, 1 Apr 2025 18:56:31 -0600 Subject: [PATCH 3/4] use spack action --- .github/workflows/spack.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/spack.yml b/.github/workflows/spack.yml index 6aea85a..6627d15 100644 --- a/.github/workflows/spack.yml +++ b/.github/workflows/spack.yml @@ -47,29 +47,29 @@ jobs: if: always() run: | sudo apt-get update - sudo apt-get install -yq ccache bzip2 ca-certificates g++ gcc gfortran git gzip lsb-release patch python3 tar unzip xz-utils zstd + sudo apt-get install -yq ccache - name: Get ccache config dir if: always() run: ccache --show-config - - name: Clone spack - if: always() - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Set up Spack + uses: spack/setup-spack@v2 with: - repository: spack/spack + ref: releases/v0.23 + buildcache: true + color: true path: spack - - name: Install - if: always() + - name: Install PyNucleus + shell: spack-bash {0} run: | - source spack/share/spack/setup-env.sh spack config add config:ccache:true spack env create pynucleus spack env activate pynucleus - spack add py-pynucleus + spack add py-pynucleus ^openmpi spack concretize - spack install + spack install --show-log-on-error - name: Remove ccache cache if: ${{ steps.ccache-restore.outputs.cache-hit }} From d6f33fa384fe10e2762b426d21c3b6920edc28eb Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Wed, 2 Apr 2025 18:26:59 -0600 Subject: [PATCH 4/4] attempt to fix package --- .github/workflows/spack.yml | 5 ++++ 0001-py-pynucleus-Set-paths.patch | 49 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 0001-py-pynucleus-Set-paths.patch diff --git a/.github/workflows/spack.yml b/.github/workflows/spack.yml index 6627d15..be95bd4 100644 --- a/.github/workflows/spack.yml +++ b/.github/workflows/spack.yml @@ -49,6 +49,10 @@ jobs: sudo apt-get update sudo apt-get install -yq ccache + - name: Check out repo + if: always() + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Get ccache config dir if: always() run: ccache --show-config @@ -64,6 +68,7 @@ jobs: - name: Install PyNucleus shell: spack-bash {0} run: | + pushd spack && git apply ../0001-py-pynucleus-Set-paths.patch && popd spack config add config:ccache:true spack env create pynucleus spack env activate pynucleus diff --git a/0001-py-pynucleus-Set-paths.patch b/0001-py-pynucleus-Set-paths.patch new file mode 100644 index 0000000..1b1439d --- /dev/null +++ b/0001-py-pynucleus-Set-paths.patch @@ -0,0 +1,49 @@ +From 2dda84b99b5b409cad68191668e6f0b2b0c66aa6 Mon Sep 17 00:00:00 2001 +From: Christian Glusa +Date: Wed, 2 Apr 2025 19:12:23 -0600 +Subject: [PATCH] py-pynucleus: Set paths + +Signed-off-by: Christian Glusa +--- + .../repos/builtin/packages/py-pynucleus/package.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/var/spack/repos/builtin/packages/py-pynucleus/package.py b/var/spack/repos/builtin/packages/py-pynucleus/package.py +index 97387177e6..c1fe39690a 100644 +--- a/var/spack/repos/builtin/packages/py-pynucleus/package.py ++++ b/var/spack/repos/builtin/packages/py-pynucleus/package.py +@@ -4,7 +4,8 @@ + + from spack.build_systems.python import PythonPipBuilder + from spack.package import * +- ++from pathlib import Path ++import os + + class PyPynucleus(PythonPackage): + """PyNucleus is a finite element code that specifically targets nonlocal operators.""" +@@ -56,6 +57,7 @@ class PyPynucleus(PythonPackage): + + def setup_build_environment(self, env): + env.set("PYNUCLEUS_BUILD_PARALLELISM", make_jobs) ++ env.prepend_path("PYTHONPATH", self.prefix) + + @run_before("install") + def install_python(self): +@@ -63,6 +65,13 @@ def install_python(self): + with working_dir(subpackage): + pip(*PythonPipBuilder.std_args(self), f"--prefix={self.prefix}", ".") + ++ # os.environ['PYTHONPATH'] = os.getcwd()+':'+os.environ["PYTHONPATH"] ++ ++ d = list((Path(os.getcwd())/'build').glob("lib.*")) ++ if len(d) > 0: ++ p = d[0] ++ os.environ['PYTHONPATH'] = str(p)+':'+os.environ["PYTHONPATH"] ++ + @run_after("install") + def install_additional_files(self): + spec = self.spec +-- +2.49.0 +