From 0d7933031b6b0a9919ba24b91c45c1eae8e528f4 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Tue, 4 Jul 2023 12:05:45 -0400 Subject: [PATCH] Add Python 3.11-based image --- .github/workflows/py311.yaml | 59 ++++++++++++++++++++++++++++++++++++ py311/Dockerfile | 39 ++++++++++++++++++++++++ py311/condarc | 7 +++++ py311/environment.yml | 17 +++++++++++ py311/test.bash | 9 ++++++ 5 files changed, 131 insertions(+) create mode 100644 .github/workflows/py311.yaml create mode 100644 py311/Dockerfile create mode 100644 py311/condarc create mode 100644 py311/environment.yml create mode 100755 py311/test.bash diff --git a/.github/workflows/py311.yaml b/.github/workflows/py311.yaml new file mode 100644 index 0000000..1af2add --- /dev/null +++ b/.github/workflows/py311.yaml @@ -0,0 +1,59 @@ +name: py311img + +on: + push: + branches: + - 'main' + schedule: + - cron: '0 11 * * 2' + pull_request: + branches: + - 'main' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Gather metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: | + shivupa/cclib-ci + flavor: | + latest=true + tags: | + type=schedule,pattern={{date 'YYYYMMDD'}},prefix=py311- + type=sha,prefix=py311- + type=edge,prefix=py311- + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Build and export to Docker + uses: docker/build-push-action@v3 + with: + context: py311 + push: false + load: true + tags: ${{ steps.meta.outputs.tags }} + - + name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v3 + with: + context: py311 + push: ${{ github.event_name != 'pull_request'}} + tags: ${{ steps.meta.outputs.tags }} diff --git a/py311/Dockerfile b/py311/Dockerfile new file mode 100644 index 0000000..c25dda7 --- /dev/null +++ b/py311/Dockerfile @@ -0,0 +1,39 @@ +FROM condaforge/mambaforge:22.9.0-2@sha256:a508942c46f370f2bebd94801d6094d0d5be77c4f36ad0edd608b118998fbca8 as install + +LABEL org.opencontainers.image.authors="Shiv Upadhyay , Eric Berquist " + +SHELL ["/bin/bash", "-l", "-i", "-c"] +ENV SHELL /bin/bash + +ENV HOME /root +WORKDIR "$HOME" + +COPY ./condarc "$HOME"/.condarc +COPY ./environment.yml . + +RUN mamba info -a +RUN --mount=type=cache,target=/opt/conda/pkgs mamba env create --file="$HOME"/environment.yml --name=cclib + +RUN apt-get update && \ + apt-get install -y -qq --no-install-recommends \ + build-essential \ + curl \ + gcc \ + git \ + swig \ + && rm -rf /var/lib/apt/lists/* +RUN mamba init && \ + echo "mamba activate cclib" >> "$HOME"/.bashrc && \ + curl -o requirements.txt \ + https://raw.githubusercontent.com/cclib/cclib/master/requirements.txt && \ + mamba run -n cclib python -m pip install --no-cache-dir -r requirements.txt + +FROM install as test + +SHELL ["/bin/bash", "-l", "-i", "-c"] +WORKDIR "$HOME" +RUN git clone https://github.com/cclib/cclib.git +WORKDIR "$HOME"/cclib +COPY test.bash . +RUN ./test.bash +WORKDIR "$HOME" diff --git a/py311/condarc b/py311/condarc new file mode 100644 index 0000000..43fb86d --- /dev/null +++ b/py311/condarc @@ -0,0 +1,7 @@ +# -*- mode: yaml -*- +always_yes: true +changeps1: false +channel_priority: flexible +quiet: false +report_errors: true +verbosity: 1 diff --git a/py311/environment.yml b/py311/environment.yml new file mode 100644 index 0000000..d1991d9 --- /dev/null +++ b/py311/environment.yml @@ -0,0 +1,17 @@ +--- +channels: + - psi4 + - conda-forge + - defaults +dependencies: + - cython # only needed for pyquante2 + - h5py + - openbabel + - pip + - psi4 + - pytest-cov + - pytest-shutil + - python=3.11 + - pip: + - pyscf + - qc-iodata diff --git a/py311/test.bash b/py311/test.bash new file mode 100755 index 0000000..1c27fdf --- /dev/null +++ b/py311/test.bash @@ -0,0 +1,9 @@ +#!/usr/bin/env -S bash --login + +set -euo pipefail +set -x + +bash ./.github/scripts/run_pytest.bash +bash ./.github/scripts/run_pytest_methods.bash + +set +x