From f5c7fb069f5af3300d7badadc34ae78221dc34a4 Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Sat, 11 Nov 2023 15:24:09 +0100 Subject: [PATCH] Add GitHub Actions workflow for Docker images --- .github/dependabot.yml | 6 ++++ .github/workflows/docker.yml | 58 ++++++++++++++++++++++++++++++++++++ Docker/github_ci_dockerfile | 3 ++ Docker/openmpi_dockerfile | 5 +++- 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/docker.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..5ace4600 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..1cc23819 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,58 @@ +name: Create and publish Docker images + +on: + push: { branches: [ unstable ] } + pull_request: { branches: [ unstable ] } + workflow_call: + workflow_dispatch: + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + strategy: + fail-fast: false + matrix: + include: + - name: github_ci + #- name: jenkins_ci # flatironinstitute/cthyb:master-ubuntu-clang not accessible + #- name: mpich # outdated dependencies (GCC too old, need to install LLVM) + - name: openmpi + #- name: triqs_default # flatironinstitute/triqs:unstable-ubuntu-clang not accessible + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }}_${{ matrix.name }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./Docker + file: ./Docker/${{ matrix.name }}_dockerfile + build-args: | + NCORES=2 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Docker/github_ci_dockerfile b/Docker/github_ci_dockerfile index 4833d2e8..449dd78a 100644 --- a/Docker/github_ci_dockerfile +++ b/Docker/github_ci_dockerfile @@ -81,6 +81,9 @@ ENV CPATH=/triqs/include:${CPATH} \ LD_LIBRARY_PATH=/triqs/lib:${LD_LIBRARY_PATH} \ PYTHONPATH=/triqs/lib/python3.10/site-packages:${PYTHONPATH} \ CMAKE_PREFIX_PATH=/triqs/share/cmake:${CMAKE_PREFIX_PATH} \ + CMAKE_BUILD_PARALLEL_LEVEL=${NCORES} \ + CTEST_OUTPUT_ON_FAILURE=1 \ + CTEST_PARALLEL_LEVEL=${NCORES} \ TRIQS_ROOT=/triqs RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/triqs \ diff --git a/Docker/openmpi_dockerfile b/Docker/openmpi_dockerfile index 2bc7f3b1..1db31cc8 100644 --- a/Docker/openmpi_dockerfile +++ b/Docker/openmpi_dockerfile @@ -159,12 +159,15 @@ RUN cd /source && wget --quiet https://gitlab.com/QEF/q-e/-/archive/qe-7.2/q-e-q #ENV PATH=/vasp/bin:${PATH} # triqs -ENV CPATH=/triqs/include:${CPATH} \ +ENV CPATH=/triqs/include:/usr/include/mkl:${CPATH} \ PATH=/triqs/bin:${PATH} \ LIBRARY_PATH=/triqs/lib:${LIBRARY_PATH} \ LD_LIBRARY_PATH=/triqs/lib:${LD_LIBRARY_PATH} \ PYTHONPATH=/triqs/lib/python3.10/site-packages:${PYTHONPATH} \ CMAKE_PREFIX_PATH=/triqs/share/cmake:${CMAKE_PREFIX_PATH} \ + CMAKE_BUILD_PARALLEL_LEVEL=${NCORES} \ + CTEST_OUTPUT_ON_FAILURE=1 \ + CTEST_PARALLEL_LEVEL=${NCORES} \ TRIQS_ROOT=/triqs RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/triqs triqs.src \