Test Spack builds #837
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Spack builds | |
| on: | |
| # Uncomment the below 'push' to trigger on push | |
| # push: | |
| # branches: | |
| # - "**" | |
| schedule: | |
| # '*' is a special character in YAML, so string must be quoted | |
| - cron: "0 2 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| spack_package_repo: | |
| description: "Spack package repository to test" | |
| default: "spack/spack-packages" | |
| type: string | |
| spack_package_ref: | |
| description: "Spack package repository branch/tag to test" | |
| default: "develop" | |
| type: string | |
| env: | |
| GITHUB_USER: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| OMPI_ALLOW_RUN_AS_ROOT: 1 | |
| OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 | |
| PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe # Newer OpenMPI | |
| OMPI_MCA_rmaps_base_oversubscribe: true # Older OpenMPI | |
| jobs: | |
| cpp-main: | |
| name: Build DOLFINx (C++, main) | |
| runs-on: ubuntu-latest | |
| container: ubuntu:24.04 | |
| steps: | |
| - name: Install Spack requirements | |
| run: | | |
| apt-get -y update | |
| apt-get install -y bzip2 curl file git gzip make patch python3-minimal tar unzip xz-utils | |
| apt-get install -y g++ gfortran # compilers | |
| - name: Get DOLFINx code (to access Spack config and test files) | |
| uses: actions/checkout@v6 | |
| - name: Set up Spack | |
| uses: spack/setup-spack@main | |
| with: | |
| ref: develop # Spack version (examples: develop, releases/v0.23) | |
| color: true # Force color output (SPACK_COLOR=always) | |
| path: spack-src # Where to clone Spack | |
| - name: Add Spack package repository | |
| if: github.event_name == 'workflow_dispatch' | |
| shell: spack-bash {0} | |
| run: | | |
| spack repo update | |
| spack repo add --name test_pkgs https://github.com/${{ github.event.inputs.spack_package_repo }}.git ~/test_pkgs | |
| spack repo update --branch ${{ github.event.inputs.spack_package_ref }} test_pkgs | |
| spack repo list | |
| spack config get repos | |
| - name: Build DOLFINx | |
| shell: spack-bash {0} | |
| run: | | |
| spack env create dolfinx .github/workflows/spack-config/gh-actions-env.yml | |
| spack -e dolfinx install -j4 -p2 --use-buildcache=package:never,dependencies:auto --add fenics-dolfinx@main+petsc | |
| spack repo list | |
| spack config get repos | |
| - name: Run a C++ test | |
| shell: spack-bash {0} | |
| run: | | |
| cat .github/workflows/spack-config/gh-actions-env.yml | |
| spack env create dolfinx-test .github/workflows/spack-config/gh-actions-env.yml | |
| spack -e dolfinx-test install -j4 -p2 --use-buildcache=package:never,dependencies:auto --add fenics-dolfinx@main+petsc py-fenics-ffcx@main | |
| spack env activate dolfinx-test | |
| spack load cmake | |
| cd cpp/demo/poisson | |
| cmake . | |
| make | |
| mpirun -np 2 ./demo_poisson | |
| - name: Push packages and update index | |
| env: | |
| GITHUB_USER: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| spack -e dolfinx buildcache push --base-image ubuntu:24.04 --only dependencies --with-build-dependencies --update-index local-buildcache | |
| if: ${{ !cancelled() }} | |
| python-main: | |
| name: Build DOLFINx (Python, main) | |
| runs-on: ubuntu-latest | |
| container: ubuntu:24.04 | |
| steps: | |
| - name: Install Spack requirements | |
| run: | | |
| apt-get -y update | |
| apt-get install -y bzip2 curl file git gzip make patch python3-minimal tar unzip xz-utils | |
| apt-get install -y g++ gfortran # compilers | |
| - name: Get DOLFINx code (to access Spack config and test files) | |
| uses: actions/checkout@v6 | |
| - name: Set up Spack | |
| uses: spack/setup-spack@main | |
| with: | |
| ref: develop # Spack version (examples: develop, releases/v0.23) | |
| color: true # Force color output (SPACK_COLOR=always) | |
| path: spack-src # Where to clone Spack | |
| - name: Add Spack package repository | |
| if: github.event_name == 'workflow_dispatch' | |
| shell: spack-bash {0} | |
| run: | | |
| spack repo update | |
| spack repo add --name test_pkgs https://github.com/${{ github.event.inputs.spack_package_repo }}.git ~/test_pkgs | |
| spack repo update --branch ${{ github.event.inputs.spack_package_ref }} test_pkgs | |
| spack repo list | |
| spack config get repos | |
| - name: Build DOLFINx | |
| shell: spack-bash {0} | |
| run: | | |
| cat .github/workflows/spack-config/gh-actions-env.yml | |
| spack env create dolfinx .github/workflows/spack-config/gh-actions-env.yml | |
| spack -e dolfinx install -j4 -p2 --use-buildcache=package:never,dependencies:auto --add py-fenics-dolfinx@main %fenics-dolfinx+petsc~adios2 | |
| spack repo list | |
| spack config get repos | |
| - name: Run a Python test | |
| shell: spack-bash {0} | |
| run: | | |
| cat .github/workflows/spack-config/gh-actions-env.yml | |
| spack env create dolfinx-test .github/workflows/spack-config/gh-actions-env.yml | |
| spack -e dolfinx-test install -j4 -p2 --use-buildcache=package:never,dependencies:auto --add py-fenics-dolfinx@main +petsc4py +slepc4py %fenics-dolfinx~adios2 py-setuptools | |
| spack env activate dolfinx-test | |
| spack compiler find | |
| spack load gcc | |
| mpirun -np 2 python python/demo/demo_elasticity.py | |
| - name: Push packages and update index | |
| env: | |
| GITHUB_USER: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| spack -e dolfinx buildcache push --base-image ubuntu:24.04 --only dependencies --with-build-dependencies --update-index local-buildcache | |
| if: ${{ !cancelled() }} |