From 2f5009e62d02ca454ba216f94e7d81b67abd7078 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 02:52:59 +0000 Subject: [PATCH 1/3] Bump idna from 3.4 to 3.7 in /docs Bumps [idna](https://github.com/kjd/idna) from 3.4 to 3.7. - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst) - [Commits](https://github.com/kjd/idna/compare/v3.4...v3.7) --- updated-dependencies: - dependency-name: idna dependency-type: indirect ... Signed-off-by: dependabot[bot] --- docs/requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 7c8bea324..cb854f417 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -22,7 +22,7 @@ docutils==0.17.1 # via # pydata-sphinx-theme # sphinx -idna==3.4 +idna==3.7 # via requests imagesize==1.4.1 # via sphinx @@ -37,7 +37,7 @@ packaging==23.1 # pydata-sphinx-theme # sphinx pydata-sphinx-theme==0.13.3 - # via -r docs/requirements.in + # via -r requirements.in pygments==2.15.1 # via # accessible-pygments @@ -51,11 +51,11 @@ soupsieve==2.4.1 # via beautifulsoup4 sphinx==4.5.0 # via - # -r docs/requirements.in + # -r requirements.in # pydata-sphinx-theme # sphinx-design sphinx-design==0.4.1 - # via -r docs/requirements.in + # via -r requirements.in sphinxcontrib-applehelp==1.0.4 # via sphinx sphinxcontrib-devhelp==1.0.2 From 71cf2ffadd149f206d65b7143e38940ddf8c87eb Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Fri, 19 Jul 2024 10:04:34 +0100 Subject: [PATCH 2/3] Remove arm64 build (#776) * Remove arm64 build * Move Dockerfile up * Remove firefox tests * Don't push to dockerhub --- .github/actions/create-dev-env/action.yml | 27 ---- .github/actions/integration-tests/action.yml | 59 ------- .github/actions/load-image/action.yml | 31 ---- .../workflows/docker-build-test-upload.yml | 125 ++++++++------- .github/workflows/docker-merge-tags.yml | 65 -------- .github/workflows/docker-push.yml | 93 ----------- .github/workflows/docker.yml | 144 ------------------ docker/Dockerfile => Dockerfile | 19 +-- README.md | 9 +- .../70_prepare-qe-executable.sh | 0 .../71_install-qeapp.sh | 0 docker/build.json | 10 -- docker/docker-bake.hcl | 27 ---- docker/requirements-dev.txt | 11 -- requirements-docker.txt | 6 + tests_integration/conftest.py | 10 +- tests_integration/docker-compose.yml | 2 +- 17 files changed, 89 insertions(+), 549 deletions(-) delete mode 100644 .github/actions/create-dev-env/action.yml delete mode 100644 .github/actions/integration-tests/action.yml delete mode 100644 .github/actions/load-image/action.yml delete mode 100644 .github/workflows/docker-merge-tags.yml delete mode 100644 .github/workflows/docker-push.yml delete mode 100644 .github/workflows/docker.yml rename docker/Dockerfile => Dockerfile (84%) rename {docker/before-notebook.d => before-notebook.d}/70_prepare-qe-executable.sh (100%) rename {docker/before-notebook.d => before-notebook.d}/71_install-qeapp.sh (100%) delete mode 100644 docker/build.json delete mode 100644 docker/docker-bake.hcl delete mode 100644 docker/requirements-dev.txt create mode 100644 requirements-docker.txt diff --git a/.github/actions/create-dev-env/action.yml b/.github/actions/create-dev-env/action.yml deleted file mode 100644 index b8b3d3d40..000000000 --- a/.github/actions/create-dev-env/action.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Build environment -description: Create build environment - -inputs: - architecture: - description: architecture to be run on - required: true - type: string - -runs: - using: composite - steps: - # actions/setup-python doesn't support Linux arm64 runners - # See: https://github.com/actions/setup-python/issues/108 - # python3 is manually preinstalled in the arm64 VM self-hosted runner - - name: Set Up Python 🐍 - if: ${{ inputs.architecture == 'amd64' }} - uses: actions/setup-python@v4 - with: - python-version: 3.x - - - name: Install Dev Dependencies 📦 - run: | - pip install --upgrade pip - pip install --upgrade -r docker/requirements-dev.txt - shell: bash diff --git a/.github/actions/integration-tests/action.yml b/.github/actions/integration-tests/action.yml deleted file mode 100644 index ed3f92cc3..000000000 --- a/.github/actions/integration-tests/action.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -name: Downstream tests -description: Integration downstream tests the bulid image - -inputs: - architecture: - description: Image architecture - required: true - type: string - runsOn: - description: GitHub Actions Runner image - required: true - type: string - -runs: - using: composite - - steps: - - name: Set jupyter token env - run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV - shell: bash - - - name: Run pytest to test image is working - run: TAG=newly-baked pytest tests_integration/test_image.py - shell: bash - - # The Firefox and its engine geckodrive need do be installed manually to run - # selenium tests. This only works on amd64 architecture and it should be enough only test this - # on one architecture. - - name: Install Firefox - if : ${{ inputs.architecture == 'amd64' }} - uses: browser-actions/setup-firefox@latest - with: - firefox-version: '96.0' - - - name: Install geckodriver - if : ${{ inputs.architecture == 'amd64' }} - run: | - wget -c https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz - tar xf geckodriver-v0.30.0-linux64.tar.gz -C /usr/local/bin - shell: bash - - - name: Run pytest for firefox - if : ${{ inputs.architecture == 'amd64' }} - run: TAG=newly-baked pytest --driver Firefox tests_integration/test_app.py - shell: bash - - - name: Run pytest for Chrome - if : ${{ inputs.architecture == 'amd64' }} - run: TAG=newly-baked pytest --driver Chrome tests_integration/test_app.py - shell: bash - - - name: Upload screenshots as artifacts - if : ${{ inputs.architecture == 'amd64' }} - uses: actions/upload-artifact@v4 - with: - name: Screenshots-CI-${{ inputs.architecture }} - path: screenshots/ - if-no-files-found: error diff --git a/.github/actions/load-image/action.yml b/.github/actions/load-image/action.yml deleted file mode 100644 index 4bc7a99c6..000000000 --- a/.github/actions/load-image/action.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -name: Load Docker image -description: Download image tar and load it to docker - -inputs: - image: - description: Image name - required: true - type: string - architecture: - description: Image architecture - required: true - type: string - -runs: - using: composite - steps: - - name: Download built image 📥 - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.image }}-${{ inputs.architecture }} - path: /tmp/aiidalab/ - - name: Load downloaded image to docker 📥 - run: | - docker load --input /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar - docker image ls --all - shell: bash - - name: Delete the file 🗑️ - run: rm -f /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar - shell: bash - if: always() diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index f4579cf31..ab62a71fb 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -1,78 +1,91 @@ --- -name: Build a new image and then upload the image, tags and manifests to GitHub artifacts +name: Build Docker image + +on: + pull_request: + push: + branches: + - main + tags: + - v* + workflow_dispatch: env: - OWNER: ${{ github.repository_owner }} FORCE_COLOR: 1 + IMAGE: ghcr.io/aiidalab/qe + BUILDKIT_PROGRESS: plain -on: - workflow_call: - inputs: - image: - description: Image name - required: true - type: string - architecture: - description: Image architecture, e.g. amd64, arm64 - required: true - type: string - runsOn: - description: GitHub Actions Runner image - required: true - type: string +# https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: build-test-upload: - runs-on: ${{ inputs.runsOn }} + runs-on: ubuntu-latest continue-on-error: true steps: - name: Checkout Repo ⚡️ uses: actions/checkout@v4 - - name: Create dev environment 📦 - uses: ./.github/actions/create-dev-env + + - name: Login to Container Registry 🔑 + uses: docker/login-action@v2 + if: ${{ !github.event.pull_request.head.repo.fork }} with: - architecture: ${{ inputs.architecture }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - # Self-hosted runners share a state (whole VM) between runs - # Also, they might have running or stopped containers, - # which are not cleaned up by `docker system prun` - - name: Reset docker state and cleanup artifacts 🗑️ - if: ${{ startsWith(inputs.runsOn, 'ubuntu') }} - run: | - docker kill $(docker ps --quiet) || true - docker rm $(docker ps --all --quiet) || true - docker system prune --all --force - rm -rf /tmp/aiidalab/ - shell: bash + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Build image 🛠 - working-directory: docker - run: docker buildx bake --set qe.platform=linux/${{ inputs.architecture }} -f docker-bake.hcl -f build.json --load - env: - # Use buildx - DOCKER_BUILDKIT: 1 - # Full logs for CI build - BUILDKIT_PROGRESS: plain - shell: bash + - name: Docker meta 📝 + id: meta + uses: docker/metadata-action@v5 + with: + images: | + name=${{ env.IMAGE }} + tags: | + type=ref,event=pr + type=edge,enable={{is_default_branch}} + type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} - - name: Run tests ✅ - uses: ./.github/actions/integration-tests + - name: Build and push image + id: build-upload + uses: docker/build-push-action@v5 with: - architecture: ${{ inputs.architecture }} - runsOn: ${{ inputs.runsOn }} + tags: ${{ steps.meta.outputs.tags }} + load: ${{ github.event.pull_request.head.repo.fork }} + push: ${{ ! github.event.pull_request.head.repo.fork }} + context: . + platforms: linux/amd64 + cache-to: | + type=gha,scope=${{ github.workflow }},mode=min + cache-from: | + type=gha,scope=${{ github.workflow }} - - name: Save image as a tar for later use 💾 - run: | - mkdir -p /tmp/aiidalab/ - docker save ${{ env.OWNER }}/${{ inputs.image }} -o /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar - shell: bash - if: always() + - name: Set Up Python 🐍 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install Dev Dependencies 📦 + run: pip install -r requirements-docker.txt - - name: Upload image as artifact 💾 + - name: Set jupyter token env + run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV + + - name: Run pytest for Chrome + run: pytest --driver Chrome tests_integration/ + env: + QE_IMAGE: ${{ env.IMAGE }}@${{ steps.build-upload.outputs.digest }} + + - name: Upload screenshots as artifacts + if: always() uses: actions/upload-artifact@v4 with: - name: ${{ inputs.image }}-${{ inputs.architecture }} - path: /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar - retention-days: 3 - if: always() + name: Screenshots + path: screenshots/ + if-no-files-found: error diff --git a/.github/workflows/docker-merge-tags.yml b/.github/workflows/docker-merge-tags.yml deleted file mode 100644 index b0d43fec6..000000000 --- a/.github/workflows/docker-merge-tags.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -name: Download images tags from GitHub artifacts and create multi-platform manifests - -on: - workflow_call: - inputs: - image: - description: Image name - required: true - type: string - registry: - description: Docker registry, e.g. ghcr.io, docker.io - required: true - type: string - secrets: - REGISTRY_USERNAME: - required: true - REGISTRY_TOKEN: - required: true - - -jobs: - merge-tags: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repo ⚡️ - uses: actions/checkout@v4 - - name: Create dev environment 📦 - uses: ./.github/actions/create-dev-env - with: - architecture: amd64 - - - name: Download amd64 tags file 📥 - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.registry }}-${{ inputs.image }}-amd64-tags - path: /tmp/aiidalab - - name: Download arm64 tags file 📥 - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.registry }}-${{ inputs.image }}-arm64-tags - path: /tmp/aiidalab - - - name: Login to Container Registry 🔑 - uses: docker/login-action@v2 - with: - registry: ${{ inputs.registry }} - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_TOKEN }} - - - name: Merge tags for the images of different arch 🔀 - run: | - for arch_tag in $(cat /tmp/aiidalab/${{ inputs.image }}-amd64-tags.txt); do - tag=$(echo $arch_tag | sed "s/:amd64-/:/") - docker manifest create $tag --amend $arch_tag - docker manifest push $tag - done - - for arch_tag in $(cat /tmp/aiidalab/${{ inputs.image }}-arm64-tags.txt); do - tag=$(echo $arch_tag | sed "s/:arm64-/:/") - docker manifest create $tag --amend $arch_tag - docker manifest push $tag - done - shell: bash diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml deleted file mode 100644 index ddc9d63ee..000000000 --- a/.github/workflows/docker-push.yml +++ /dev/null @@ -1,93 +0,0 @@ ---- -name: Download Docker image and its tags from GitHub artifacts, apply them and push the image to container registry - -env: - OWNER: ${{ github.repository_owner }} - -on: - workflow_call: - inputs: - image: - description: Image name - required: true - type: string - architecture: - description: Image architecture - required: true - type: string - registry: - description: Docker registry - required: true - type: string - secrets: - REGISTRY_USERNAME: - required: true - REGISTRY_TOKEN: - required: true - -jobs: - tag-push: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repo ⚡️ - uses: actions/checkout@v3 - - name: Create dev environment 📦 - uses: ./.github/actions/create-dev-env - with: - architecture: ${{ inputs.architecture }} - - name: Load image to Docker 📥 - uses: ./.github/actions/load-image - with: - image: ${{ inputs.image }} - architecture: ${{ inputs.architecture }} - - - name: Read build variables - working-directory: docker - id: build_vars - run: | - vars=$(cat build.json | jq -c '[.variable | to_entries[] | {"key": .key, "value": .value.default}] | from_entries') - echo "vars=$vars" >> "${GITHUB_OUTPUT}" - - - name: Docker meta 📝 - id: meta - uses: docker/metadata-action@v4 - env: ${{ fromJson(steps.build_vars.outputs.vars) }} - with: - images: | - name=${{ inputs.registry }}/${{ env.OWNER }}/${{ inputs.image }} - tags: | - type=edge,enable={{is_default_branch}} - type=sha,enable=${{ github.ref_type != 'tag' }} - type=ref,event=pr - type=match,pattern=v(\d{2}\.\d{2}.\d+.*),group=1 - type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} - type=raw,value=qe-${{ env.QE_VERSION }},enable=${{ startsWith(github.ref, 'refs/tags/v') }} - - - name: Login to Container Registry 🔑 - uses: docker/login-action@v2 - with: - registry: ${{ inputs.registry }} - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_TOKEN }} - - - name: Set tags for image and push 🏷️📤💾 - run: | - declare -a arr=(${{ steps.meta.outputs.tags }}) - for tag in "${arr[@]}"; do - arch_tag=$(echo ${tag} | sed "s/:/:${{ inputs.architecture }}-/") - docker tag aiidalab/${{ inputs.image }}:newly-baked ${arch_tag} - docker push ${arch_tag} - - # write tag to file - mkdir -p /tmp/aiidalab/ - echo ${arch_tag} >> /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}-tags.txt - done - shell: bash - - - name: Upload tags file 📤 - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.registry }}-${{ inputs.image }}-${{ inputs.architecture }}-tags - path: /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}-tags.txt - retention-days: 3 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 32d0d64a9..000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,144 +0,0 @@ ---- -name: Build, and push Docker Image - -on: - pull_request: - paths: - - .github/workflows/docker.yml - # We use local reusable workflows to make architecture clean an simple - # https://docs.github.com/en/actions/using-workflows/reusing-workflows - - .github/workflows/docker-build-test-upload.yml - - .github/workflows/docker-merge-tags.yml - - .github/workflows/docker-push.yml - - # We use local composite actions to combine multiple workflow steps within one action - # https://docs.github.com/en/actions/creating-actions/about-custom-actions#composite-actions - - .github/actions/create-dev-env/action.yml - - .github/actions/load-image/action.yml - - - src/** - - docker/** - - qe.ipynb - - setup.cfg - - pyproject.toml - - push: - branches: - - main - tags: - - v* - paths: - - .github/workflows/docker.yml - # We use local reusable workflows to make architecture clean an simple - # https://docs.github.com/en/actions/using-workflows/reusing-workflows - - .github/workflows/docker-build-test-upload.yml - - .github/workflows/docker-merge-tags.yml - - .github/workflows/docker-push.yml - - # We use local composite actions to combine multiple workflow steps within one action - # https://docs.github.com/en/actions/creating-actions/about-custom-actions#composite-actions - - .github/actions/create-dev-env/action.yml - - .github/actions/load-image/action.yml - - - src/** - - docker/** - - qe.ipynb - - setup.cfg - - pyproject.toml - workflow_dispatch: - schedule: - # Periodically build and test the image and keep `edge` always up-to-date - # Weekly, at 03:00 on Monday UTC time - - cron: 0 3 * * 1 - -# https://docs.github.com/en/actions/using-jobs/using-concurrency -concurrency: - # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - amd64: - uses: ./.github/workflows/docker-build-test-upload.yml - with: - image: qe - architecture: amd64 - runsOn: ubuntu-latest - - arm64: - uses: ./.github/workflows/docker-build-test-upload.yml - with: - image: qe - architecture: arm64 - runsOn: ARM64 - if: ${{ !github.event.pull_request.head.repo.fork }} - - amd64-push-ghcr: - uses: ./.github/workflows/docker-push.yml - with: - image: qe - architecture: amd64 - registry: ghcr.io - secrets: - REGISTRY_USERNAME: ${{ github.actor }} - REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }} - needs: [amd64] - if: ${{ !github.event.pull_request.head.repo.fork }} - - arm64-push-ghcr: - uses: ./.github/workflows/docker-push.yml - with: - image: qe - architecture: arm64 - registry: ghcr.io - secrets: - REGISTRY_USERNAME: ${{ github.actor }} - REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }} - needs: [arm64] - if: ${{ !github.event.pull_request.head.repo.fork }} - - merge-tags-ghcr: - uses: ./.github/workflows/docker-merge-tags.yml - with: - image: qe - registry: ghcr.io - secrets: - REGISTRY_USERNAME: ${{ github.actor }} - REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }} - needs: [amd64-push-ghcr, arm64-push-ghcr] - if: ${{ !github.event.pull_request.head.repo.fork }} - - amd64-push-dockerhub: - if: github.repository == 'aiidalab/aiidalab-qe' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - uses: ./.github/workflows/docker-push.yml - with: - image: qe - architecture: amd64 - registry: docker.io - secrets: - REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }} - REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }} - needs: [amd64] - - arm64-push-dockerhub: - if: github.repository == 'aiidalab/aiidalab-qe' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - uses: ./.github/workflows/docker-push.yml - with: - image: qe - architecture: arm64 - registry: docker.io - secrets: - REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }} - REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }} - needs: [arm64] - - merge-tags-dockerhub: - if: github.repository == 'aiidalab/aiidalab-qe' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - uses: ./.github/workflows/docker-merge-tags.yml - with: - image: qe - registry: docker.io - secrets: - REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }} - REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }} - needs: [amd64-push-dockerhub, arm64-push-dockerhub] diff --git a/docker/Dockerfile b/Dockerfile similarity index 84% rename from docker/Dockerfile rename to Dockerfile index aca8a4731..c53456900 100644 --- a/docker/Dockerfile +++ b/Dockerfile @@ -1,18 +1,18 @@ # syntax=docker/dockerfile:1 -FROM ghcr.io/astral-sh/uv:0.2.18 as uv -FROM base-image +FROM ghcr.io/astral-sh/uv:0.2.18 AS uv +FROM ghcr.io/aiidalab/full-stack:2024.1019 # Copy whole repo and pre-install the dependencies and app to the tmp folder. # In the before notebook scripts the app will be re-installed by moving it to the app folder. -ENV PREINSTALL_APP_FOLDER ${CONDA_DIR}/aiidalab-qe -COPY --chown=${NB_UID}:${NB_GID} --from=src . ${PREINSTALL_APP_FOLDER} +ENV PREINSTALL_APP_FOLDER=${CONDA_DIR}/aiidalab-qe +COPY --chown=${NB_UID}:${NB_GID} . ${PREINSTALL_APP_FOLDER} USER ${NB_USER} # Using uv to speed up installation, per docs: # https://github.com/astral-sh/uv/blob/main/docs/guides/docker.md#using-uv-temporarily # Use the same constraint file as PIP -ENV UV_CONSTRAINT ${PIP_CONSTRAINT} +ENV UV_CONSTRAINT=${PIP_CONSTRAINT} RUN --mount=from=uv,source=/uv,target=/bin/uv \ cd ${PREINSTALL_APP_FOLDER} && \ # Remove all untracked files and directories. For example the setup lock flag file. @@ -31,12 +31,7 @@ RUN --mount=from=uv,source=/uv,target=/bin/uv \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" -# The app version is used for installing the app when first time the container is started. -ARG APP_VERSION -ENV APP_VERSION ${APP_VERSION} - -ARG QE_VERSION -ENV QE_VERSION ${QE_VERSION} +ENV QE_VERSION="7.2" RUN mamba create -p /opt/conda/envs/quantum-espresso --yes \ qe=${QE_VERSION} \ && mamba clean --all -f -y && \ @@ -44,7 +39,7 @@ RUN mamba create -p /opt/conda/envs/quantum-espresso --yes \ fix-permissions "/home/${NB_USER}" # Download the QE pseudopotentials to the folder for afterware installation. -ENV PSEUDO_FOLDER ${CONDA_DIR}/pseudo +ENV PSEUDO_FOLDER=${CONDA_DIR}/pseudo RUN mkdir -p ${PSEUDO_FOLDER} && \ python -m aiidalab_qe download-pseudos --dest ${PSEUDO_FOLDER} diff --git a/README.md b/README.md index 2c3725ab2..f5c167709 100644 --- a/README.md +++ b/README.md @@ -32,15 +32,14 @@ pytest -sv tests To run the integration tests, you need to build the Docker image first: ``` -cd docker/ -docker buildx bake -f build.json -f docker-bake.hcl --set "*.platform=linux/amd64" --load +docker build . -t aiidalab/qe ``` Then, you can run the integration tests with: ```bash -JUPYTER_TOKEN=max TAG=newly-baked pytest --driver Chrome tests_integration -sv -`````` +pytest --driver Chrome tests_integration +``` ## For maintainers @@ -57,7 +56,7 @@ Additional notes: - Use the `--dry` option to preview the release change. - The release tag (e.g. a/b/rc) is determined from the last release. Use the `--tag` option to switch the release tag. - - For making "outdate" release since we fix minor version to `2x.04.xx` and `2x.10.xx`, use e.g. `bumpver update --set-version v23.10.0rc4 --ignore-vcs-tag` to make the release. + - For making "outdated" release since we fix minor version to `2x.04.xx` and `2x.10.xx`, use e.g. `bumpver update --set-version v23.10.0rc4 --ignore-vcs-tag` to make the release. ## Acknowledgements We acknowledge support from: diff --git a/docker/before-notebook.d/70_prepare-qe-executable.sh b/before-notebook.d/70_prepare-qe-executable.sh similarity index 100% rename from docker/before-notebook.d/70_prepare-qe-executable.sh rename to before-notebook.d/70_prepare-qe-executable.sh diff --git a/docker/before-notebook.d/71_install-qeapp.sh b/before-notebook.d/71_install-qeapp.sh similarity index 100% rename from docker/before-notebook.d/71_install-qeapp.sh rename to before-notebook.d/71_install-qeapp.sh diff --git a/docker/build.json b/docker/build.json deleted file mode 100644 index 44dc1b92a..000000000 --- a/docker/build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "variable": { - "AIIDALAB_BASE_IMAGE": { - "default": "ghcr.io/aiidalab/full-stack:2024.1019" - }, - "QE_VERSION": { - "default": "7.2" - } - } -} diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl deleted file mode 100644 index 97017844f..000000000 --- a/docker/docker-bake.hcl +++ /dev/null @@ -1,27 +0,0 @@ -# docker-bake.hcl for building QeApp images -group "default" { - targets = ["qe"] -} - -variable "QE_VERSION" { -} - -variable "BASE_IMAGE" { - default = "aiidalab/full-stack:latest" -} - -variable "ORGANIZATION" { - default = "aiidalab" -} - -target "qe" { - tags = ["${ORGANIZATION}/qe:newly-baked"] - context = "." - contexts = { - src = ".." - base-image = "docker-image://${BASE_IMAGE}" - } - args = { - "QE_VERSION" = "${QE_VERSION}" - } -} diff --git a/docker/requirements-dev.txt b/docker/requirements-dev.txt deleted file mode 100644 index 4c8d31491..000000000 --- a/docker/requirements-dev.txt +++ /dev/null @@ -1,11 +0,0 @@ -docker -requests -pre-commit -pytest -pytest-docker - -# test dependencies -pytest-selenium -pytest-html<4.0 -selenium~=4.9.0 -webdriver-manager diff --git a/requirements-docker.txt b/requirements-docker.txt new file mode 100644 index 000000000..4cfdbb2c9 --- /dev/null +++ b/requirements-docker.txt @@ -0,0 +1,6 @@ +docker +requests +pytest~=8.2.0 +pytest-docker~=3.0 +pytest-selenium~=4.1 +selenium==4.20.0 diff --git a/tests_integration/conftest.py b/tests_integration/conftest.py index f27cc24ac..cbd576174 100644 --- a/tests_integration/conftest.py +++ b/tests_integration/conftest.py @@ -4,7 +4,7 @@ import pytest import requests -import selenium.webdriver.support.expected_conditions as EC +import selenium.webdriver.support.expected_conditions as ec from requests.exceptions import ConnectionError from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait @@ -85,7 +85,7 @@ def _selenium_driver(nb_path, wait_time=5.0): selenium.find_element(By.ID, "ipython-main-app") selenium.find_element(By.ID, "notebook-container") WebDriverWait(selenium, 100).until( - EC.invisibility_of_element((By.ID, "appmode-busy")) + ec.invisibility_of_element((By.ID, "appmode-busy")) ) return selenium @@ -116,12 +116,6 @@ def screenshot_dir(): return sdir -@pytest.fixture -def firefox_options(firefox_options): - firefox_options.add_argument("--headless") - return firefox_options - - @pytest.fixture def chrome_options(chrome_options): chrome_options.add_argument("--headless") diff --git a/tests_integration/docker-compose.yml b/tests_integration/docker-compose.yml index 5c506843b..9a5a6809b 100644 --- a/tests_integration/docker-compose.yml +++ b/tests_integration/docker-compose.yml @@ -4,7 +4,7 @@ version: '3.4' services: aiidalab: - image: ${REGISTRY:-}${QE_IMAGE:-aiidalab/qe}:${TAG:-newly-baked} + image: ${REGISTRY:-}${QE_IMAGE:-aiidalab/qe}${TAG} environment: TZ: Europe/Zurich DOCKER_STACKS_JUPYTER_CMD: notebook From bdefa84f145b28fea615174ecfb8e3288c607010 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Fri, 19 Jul 2024 12:22:09 +0100 Subject: [PATCH 3/3] Fix Docker build on main branch (#779) --- .github/workflows/docker-build-test-upload.yml | 4 ++-- tests_integration/docker-compose.yml | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index ab62a71fb..c285cf4d0 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -57,8 +57,8 @@ jobs: uses: docker/build-push-action@v5 with: tags: ${{ steps.meta.outputs.tags }} - load: ${{ github.event.pull_request.head.repo.fork }} - push: ${{ ! github.event.pull_request.head.repo.fork }} + load: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }} + push: ${{ ! (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} context: . platforms: linux/amd64 cache-to: | diff --git a/tests_integration/docker-compose.yml b/tests_integration/docker-compose.yml index 9a5a6809b..cd9e4f03c 100644 --- a/tests_integration/docker-compose.yml +++ b/tests_integration/docker-compose.yml @@ -1,10 +1,8 @@ --- -version: '3.4' - services: aiidalab: - image: ${REGISTRY:-}${QE_IMAGE:-aiidalab/qe}${TAG} + image: ${REGISTRY:-}${QE_IMAGE:-aiidalab/qe}${TAG:-} environment: TZ: Europe/Zurich DOCKER_STACKS_JUPYTER_CMD: notebook