diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 116c7a85b9b596db1fd3bf4f611923983ee4380e..8ed205bf492bb83f4858d8b25db4dad930a15fcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,65 +81,30 @@ jobs: coverageCommand: coverage report coverageLocations: coverage.xml:coverage.py - build-matrix: - name: Unit tests - Python versions + push_to_registry: + name: Push Docker image to Docker Hub runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8, 3.9, '3.10', '3.11'] steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a with: - python-version: ${{ matrix.python-version }} - - name: Print available disk space before graphnet install - run: df -h - - name: Install package - uses: ./.github/actions/install + username: orsoe + password: dckr_pat_eP0lvZfmmBq29otJ2gzOqfzYM2o + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: - editable: true - - name: Print available disk space after graphnet install - run: df -h - - name: Print packages in pip - run: | - pip show torch - pip show torch-geometric - pip show torch-cluster - pip show torch-sparse - pip show torch-scatter - - name: Run unit tests and generate coverage report - run: | - set -o pipefail # To propagate exit code from pytest - coverage run --source=graphnet -m pytest tests/ --ignore=tests/utilities --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/01_icetray/ - coverage run --source=graphnet -m pytest tests/utilities - coverage report -m - - name: Print available disk space after unit tests - run: df -h - - build-macos: - name: Unit tests - macOS - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - name: Install package - uses: ./.github/actions/install + images: orsoe/graphnet + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: - editable: true - hardware: "macos" - - name: Print packages in pip - run: | - pip show torch - pip show torch-geometric - pip show torch-cluster - pip show torch-sparse - pip show torch-scatter - - name: Run unit tests and generate coverage report - run: | - set -o pipefail # To propagate exit code from pytest - coverage run --source=graphnet -m pytest tests/ --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/ - coverage report -m \ No newline at end of file + context: . + file: ./dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/dockerfile b/.github/workflows/dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8f4ffb5d24a8d5a94e8045ee53c897969f0a52e4 --- /dev/null +++ b/.github/workflows/dockerfile @@ -0,0 +1,26 @@ +FROM icecube/icetray:icetray-prod-v1.8.1-ubuntu20.04-X64 + +ARG TORCH=1.9.1 +ARG PYG=2.0.1 +ARG CUDA=cpu + +RUN apt-get --yes install sudo + sudo apt update --fix-missing --yes + sudo apt upgrade --yes + sudo apt-get install --yes git-all + +RUN pip3 install torch==${TORCH}+${CUDA} -f https://download.pytorch.org/whl/cpu/torch_stable.html && \ + pip3 install torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \ + pip3 install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \ + pip3 install torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \ + pip3 install torch-spline-conv -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \ + pip3 install torch-geometric==${PYG} + +RUN pip3 install git+https://github.com/icecube/graphnet.git + +WORKDIR /root + +ADD module.py ./module.py +ADD apply.py ./apply.py + +CMD [ "/bin/bash" ] \ No newline at end of file