Skip to content

Add path filter to only run CI as necessary #12

Add path filter to only run CI as necessary

Add path filter to only run CI as necessary #12

Workflow file for this run

name: Path Filter
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
path-filter:
runs-on: ubuntu-latest
outputs:
code_changed: ${{ steps.filter.outputs.code_changed }}
source_changed: ${{ steps.filter.outputs.source_changed }}
examples_changed: ${{ steps.filter.outputs.examples_changed }}
tests_changed: ${{ steps.filter.outputs.tests_changed }}
linux_workflow_changed: ${{ steps.filter.outputs.linux_workflow_changed }}
macos_workflow_changed: ${{ steps.filter.outputs.macos_workflow_changed }}
spack_changed: ${{ steps.filter.outputs.spack_changed }}
singularity_changed: ${{ steps.filter.outputs.singularity_changed }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
source_changed:
- 'palace/**'
- 'cmake/**'
- 'extern/**'
examples_changed:
- 'examples/**'
- 'test/examples/**'
tests_changed:
- 'test/unit/**'
linux_workflow_changed:
- '.github/workflows/build-and-test-linux.yml'
macos_workflow_changed:
- '.github/workflows/build-and-test-linux.yml'
spack_changed:
- 'spack_repo/**'
- '.github/workflows/spack.yml'
singularity_changed:
- 'singularity/**'
- '.github/workflows/singularity.yml'
code_changed:
- any: ['source_changed', 'examples_changed', 'tests_changed']
# Dummy jobs that succeed when only spack, singularity or docs files change
build-and-test-linux:
needs: path-filter
if: |
${{ needs.path-filter.outputs.code_changed == 'false'
&& needs.path-filter.outputs.linux_workflow_changed == 'false'}}
strategy:
matrix:
include:
# List of configuration that must be kept in sync with build-and-test-linux.yml
- config: "x86, intel, intelmpi, intelmkl, shared, int64, openmp, slepc, superlu"
- config: "x86, clang, openmpi, aocl, static, int64, serial, slepc, mumps"
- config: "x86, gcc, openmpi, openblas, shared, int64, openmp, slepc, strumpack"
- config: "x86, intel, intelmpi, intelmkl, static, int32, serial, arpack, superlu"
- config: "x86, intel, intelmpi, intelmkl, static, int32, openmp, slepc, strumpack"
- config: "x86, intel, intelmpi, intelmkl, shared, int64, serial, arpack, mumps"
- config: "x86, gcc, openmpi, aocl, shared, int32, serial, arpack, superlu"
- config: "arm, gcc, mpich, openblas, shared, int64, openmp, slepc, superlu"
- config: "arm, clang, openmpi, armpl, static, int32, serial, arpack, strumpack"
- config: "arm, clang, mpich, armpl, shared, int32, serial, arpack, mumps"
- config: "arm, gcc, openmpi, openblas, static, int64, serial, slepc, mumps"
- config: "arm, gcc, openmpi, armpl, shared, int64, serial, arpack, superlu"
- config: "arm, clang, mpich, openblas, static, int32, openmp, slepc, strumpack"
- config: "arm, clang, mpich, openblas, static, int64, serial, arpack, superlu"
- config: "arm, gcc, openmpi, armpl, shared, int32, openmp, slepc, strumpack"
- config: "arm, gcc, openmpi, armpl, shared, int32, openmp, slepc, superlu"
- config: "arm, gcc, openmpi, armpl, shared, int64, openmp, slepc, strumpack"
name: build-and-test-linux (${{ matrix.config }})
runs-on: ubuntu-latest
steps:
- run: echo "Skipping linux build (${{ matrix.config }}) because there were no relevant changes!"
build-and-test-macos:
needs: path-filter
if: |
${{ needs.path-filter.outputs.code_changed == 'false'
&& needs.path-filter.outputs.macos_workflow_changed == 'false'}}
strategy:
matrix:
include:
# List of configuration that must be kept in sync with build-and-test-macos.yml
- config: "clang, openmpi, armpl, static, int32, serial, arpack, strumpack"
- config: "gcc, openmpi, openblas, static, int64, serial, slepc, mumps"
- config: "gcc, openmpi, armpl, shared, int64, serial, arpack, superlu"
- config: "clang, mpich, openblas, static, int32, openmp, slepc, strumpack"
- config: "clang, mpich, openblas, static, int64, serial, arpack, superlu"
name: build-and-test-macos (${{ matrix.config }})
runs-on: macos-latest
steps:
- run: echo "Skipping macos build (${{ matrix.config }}) because there were no relevant changes!"
build-and-test-spack:
needs: path-filter
if: |
${{ needs.path-filter.outputs.code_changed == 'false'
&& needs.path-filter.outputs.spack_changed == 'false'}}
strategy:
matrix:
include:
# List of configuration that must be kept in sync with spack.yml
- config: "gcc, none, openblas, develop, openmpi"
name: build-and-test-spack (${{ matrix.config }})
runs-on: ubuntu-latest
steps:
- run: echo "Skipping spack build (${{ matrix.config }}) because there were no relevant changes!"
build-and-test-singularity:
needs: path-filter
if: |
${{ needs.path-filter.outputs.code_changed == 'false'
&& needs.path-filter.outputs.singularity_changed == 'false'}}
name: build-and-test-singularity
runs-on: ubuntu-latest
steps:
- run: echo "Skipping singularity build because there were no relevant changes!"