nightly? #291
Workflow file for this run
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@v2 | |
- 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' }} | |
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:${{ needs.configure-docker.outputs.dockertag }} | |
target: bempp-dev-env | |
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@v2 | |
- run: | | |
sudo apt-get install -y python3-setuptools | |
pip3 install pydocstyle flake8 | |
name: Install Python style tools | |
- run: | | |
python3 -m flake8 bempp | |
python3 -m flake8 test | |
python3 -m flake8 .github/scripts | |
name: Run flake8 checks | |
- run: python3 -m pydocstyle bempp/api | |
name: Run pydocstyle 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:${{ needs.configure-docker.outputs.dockertag }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: python3 setup.py install | |
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:${{ needs.configure-docker.outputs.dockertag }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: python3 setup.py install | |
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 | |