-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/.* | ||
build | ||
doc | ||
tutorial | ||
extra | ||
archive | ||
*.md |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: "Tests with Containers" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
- dev | ||
- hotfixes | ||
|
||
jobs: | ||
build-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 10 | ||
fail-fast: true | ||
matrix: | ||
python-version: ['3.7','3.8','3.9','3.10'] | ||
platform: ['core', 'full'] # ['pycuda', 'cupy'] | ||
name: Testing ${{ matrix.platform }}/python=${{ matrix.python-version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
tags: ptypy_${{ matrix.platform }}_py${{ matrix.python-version }}_dev:latest | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
target: runtime | ||
build-args: | | ||
PYTHON_VERSION=${{ matrix.python-version }} | ||
PLATFORM=${{ matrix.platform }} | ||
- name: Run test inside container | ||
run: docker run ptypy_${{ matrix.platform }}_py${{ matrix.python-version }}_dev:latest pytest | ||
|
||
flake8-lint: | ||
runs-on: ubuntu-latest | ||
name: Lint | ||
steps: | ||
- name: Check out source repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Python environment | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: flake8 Lint | ||
uses: py-actions/flake8@v2 | ||
with: | ||
max-line-length: "120" | ||
exclude: "./archive,./benchmark" | ||
args: "--count --select=E9,F63,F7,F82 --show-source --statistics" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Set global build arguments | ||
ARG PLATFORM=cupy | ||
n | ||
# Pull from miniconda image and install core dependencies | ||
FROM continuumio/miniconda3 as core | ||
|
||
# Basic conda installation | ||
COPY ./dependencies_core.yml ./dependencies.yml | ||
RUN conda env update -n base -f dependencies.yml && conda install -y -n base pytest | ||
|
||
# Pull from miniconda image and install full dependencies | ||
FROM condaforge/mambaforge as full | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y libxml2 ssh | ||
COPY ./dependencies_full.yml ./dependencies.yml | ||
RUN mamba env update -n base -f dependencies.yml && mamba install -y -n base pytest | ||
|
||
# Pull mambaforge image and install accelerate/pycuda dependencies | ||
FROM condaforge/mambaforge as pycuda | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y libxml2 ssh | ||
COPY ./ptypy/accelerate/cuda_pycuda/dependencies.yml ./dependencies.yml | ||
COPY ./cufft/dependencies.yml ./dependencies_cufft.yml | ||
RUN mamba env update -n base -f dependencies.yml && mamba env update -n base -f dependencies_cufft.yml | ||
|
||
# Pull mambaforge image and install accelerate/cupy dependencies | ||
FROM condaforge/mambaforge as cupy | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y libxml2 ssh | ||
COPY ./ptypy/accelerate/cuda_cupy/dependencies.yml ./dependencies.yml | ||
COPY ./cufft/dependencies.yml ./dependencies_cufft.yml | ||
RUN mamba env update -n base -f dependencies.yml && mamba env update -n base -f dependencies_cufft.yml | ||
|
||
# Pull from existing image with ptypy dependencies and set up testing | ||
FROM ${PLATFORM} as runtime | ||
COPY ./ ./ | ||
RUN pip install . | ||
RUN if [ "$PLATFORM" = "pycuda" ] || [ "$PLATFORM" = "cupy" ] ; then pip install ./cufft ; fi | ||
|
||
# Run PtyPy CLI as entrypoint | ||
ENTRYPOINT ["ptypy.cli"] |