rename to bempp_cl #493
This file contains 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: Run tests and style checks | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 7 * * 1" | |
jobs: | |
configure-docker: | |
name: Configure options for Docker image | |
runs-on: ubuntu-latest | |
outputs: | |
dockertag: ${{ steps.dockertag.outputs.tag }} | |
buildneeded: ${{ steps.diff.outputs.changed }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get main Dockerfile | |
run: | | |
git clone https://github.com/bempp/bempp-cl.git bempp-main | |
cp bempp-main/Dockerfile Dockerfile.old | |
rm -rf bempp-main | |
if: github.ref != 'refs/heads/main' | |
- name: Make dummy old Dockerfile | |
run: touch Dockerfile.old | |
if: github.ref == 'refs/heads/main' | |
- name: compare Dockerfile with old Dockerfile | |
id: diff | |
run: | | |
if diff Dockerfile Dockerfile.old > /dev/null; then | |
echo "changed=no" >> $GITHUB_OUTPUT | |
else | |
echo "changed=yes" >> $GITHUB_OUTPUT | |
fi | |
- name: set Docker tag | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
echo "tag=main" >> $GITHUB_OUTPUT | |
elif [ "${{ steps.diff.outputs.changed }}" = "yes" ]; then | |
the_tag=($(echo "${{ github.ref }}" | sha1sum)) | |
echo "tag=$the_tag" >> $GITHUB_OUTPUT | |
else | |
echo "tag=main" >> $GITHUB_OUTPUT | |
fi | |
id: dockertag | |
build-and-publish-docker-fenicsx: | |
name: Build testing docker image with FEniCSx | |
runs-on: ubuntu-latest | |
needs: | |
- configure-docker | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Build and push testing Docker image with FEniCSx | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env-with-dolfinx:${{ needs.configure-docker.outputs.dockertag }} | |
target: bempp-dev-env-with-dolfinx | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Push latest tag | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env-with-dolfinx:latest | |
target: bempp-dev-env-with-dolfinx | |
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }} | |
- name: Build and push testing Docker image with FEniCSx (Numba only version) | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env-with-dolfinx-numba:${{ needs.configure-docker.outputs.dockertag }} | |
target: bempp-dev-env-with-dolfinx-numba | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Push latest tag (Numba only version) | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env-with-dolfinx-numba:latest | |
target: bempp-dev-env-with-dolfinx-numba | |
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }} | |
build-and-publish-docker: | |
name: Build testing docker image | |
runs-on: ubuntu-latest | |
needs: | |
- configure-docker | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Build and push testing Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env:${{ needs.configure-docker.outputs.dockertag }} | |
target: bempp-dev-env | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Push latest tag | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env:latest | |
target: bempp-dev-env | |
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }} | |
- name: Build and push testing Docker image (Numba only version) | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }} | |
target: bempp-dev-env-numba | |
if: needs.configure-docker.outputs.buildneeded == 'yes' | |
- name: Push latest tag (Numba only version) | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: bempp/cl-dev-env-numba:latest | |
target: bempp-dev-env-numba | |
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }} | |
style-checks: | |
name: Run style checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- run: python3 -m pip install .[style] | |
name: Install Bempp with optional style dependencies | |
- run: | | |
python3 -m ruff check bempp_cl | |
python3 -m ruff check test | |
python3 -m ruff check examples | |
python3 -m ruff format --check bempp_cl | |
python3 -m ruff format --check test | |
python3 -m ruff format --check examples | |
name: Run ruff checks | |
build-and-test: | |
name: Build Bempp and run tests | |
needs: | |
- configure-docker | |
- build-and-publish-docker | |
- style-checks | |
runs-on: ubuntu-latest | |
container: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: python3 -m pip install .[test] | |
name: Install Bempp | |
- run: python3 -m pytest -n4 --durations=50 test/unit --has-dolfin 0 --has-dolfinx 0 --has-exafmm 1 | |
name: Run Bempp unit tests | |
build-and-test-with-fenicsx: | |
name: Build Bempp and run tests with FEniCSx | |
needs: | |
- configure-docker | |
- build-and-publish-docker-fenicsx | |
- style-checks | |
runs-on: ubuntu-latest | |
container: bempp/cl-dev-env-with-dolfinx-numba:${{ needs.configure-docker.outputs.dockertag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: python3 -m pip install .[test] | |
name: Install Bempp | |
- run: python3 -m pytest -n4 --durations=50 test/unit --has-dolfin 0 --has-dolfinx 1 --has-exafmm 1 | |
name: Run Bempp unit tests | |
large-tests: | |
name: Run large tests | |
needs: | |
- configure-docker | |
- build-and-publish-docker | |
- style-checks | |
runs-on: ubuntu-latest | |
container: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: python3 -m pip install .[test] | |
name: Install Bempp | |
- run: python3 -m pytest --durations=10 test/validation --has-dolfin 0 --has-dolfinx 0 --has-exafmm 1 --skip ci | |
name: Run Bempp validation tests | |
run-examples: | |
name: Run examples | |
needs: | |
- configure-docker | |
- build-and-publish-docker | |
- style-checks | |
runs-on: ubuntu-latest | |
container: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: python3 -m pip install .[test] | |
name: Install Bempp | |
- run: python3 -m pytest examples/test.py --has-dolfin 0 --has-dolfinx 0 --has-exafmm 1 | |
name: Run Bempp examples | |
run-examples-fenicsx: | |
name: Run examples with FEniCSx | |
needs: | |
- configure-docker | |
- build-and-publish-docker-fenicsx | |
- style-checks | |
runs-on: ubuntu-latest | |
container: bempp/cl-dev-env-with-dolfinx-numba:${{ needs.configure-docker.outputs.dockertag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: python3 -m pip install .[test] | |
name: Install Bempp | |
- run: python3 -m pytest examples/test.py --has-dolfin 0 --has-dolfinx 1 --has-exafmm 1 --dolfin-books-only 1 | |
name: Run Bempp examples |