Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,37 @@ on:

jobs:
build:
strategy:
fail-fast: false
max-parallel: 5
matrix:
chapter:
- name: chap1
folder: Chapter01
- name: chap2
folder: Chapter02
- name: chap3
folder: Chapter03
- name: chap6
folder: Chapter06
runs-on: ubuntu-latest
name: Image ${{ matrix.chapter.name }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Build Image
id: build
run: |
cd docker
docker build . -t graph-machine-learning:latest --no-cache
docker build . --target ${{ matrix.chapter.name }} \
--build-arg branch=${{ steps.extract_branch.outputs.branch }} \
-t graph-machine-learning:latest --no-cache

- name: Test Image
id: tests
Expand All @@ -32,10 +53,7 @@ jobs:
--name graph-machine-learning-box \
graph-machine-learning:latest

# Run the tests only for chapters managed by poetry
CHAPTERS=$(find Ch* -name poetry.lock -print0 | sed -e 's/\/poetry.lock//g' | xargs -0)

# Run tests
cd docker

./tests.sh $CHAPTERS
./tests.sh ${{ matrix.chapter.folder }}
5 changes: 5 additions & 0 deletions Chapter01/01_Introduction_Networkx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"sys.path.append(f\"{os.getcwd()}/..\")\n",
"\n",
"from utils import draw_graph"
]
},
Expand Down
5 changes: 5 additions & 0 deletions Chapter01/02_Graph_metrics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"sys.path.append(f\"{os.getcwd()}/..\")\n",
"\n",
"from utils import draw_graph, draw_enhanced_path"
]
},
Expand Down
5 changes: 5 additions & 0 deletions Chapter01/03_Graphs_Benchmarks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import os\n",
"import sys\n",
"\n",
"sys.path.append(f\"{os.getcwd()}/..\")\n",
"\n",
"from utils import draw_graph, FIGURES_DIR, DATA_DIR"
]
},
Expand Down
2 changes: 1 addition & 1 deletion Chapter02/01_embedding_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"\n",
"sys.path.append(f\"{os.getcwd()}/..\")\n",
"\n",
"from Chapter01.utils import draw_graph"
"from utils import draw_graph"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion Chapter03/01_Shallow_Embeddings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"\n",
"sys.path.append(f\"{os.getcwd()}/..\")\n",
"\n",
"from Chapter01.utils import draw_graph"
"from utils import draw_graph"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion Chapter03/03_Structural_deep_neural_embeddings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"\n",
"sys.path.append(f\"{os.getcwd()}/..\")\n",
"\n",
"from Chapter01.utils import DATA_DIR"
"from utils import DATA_DIR"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion Chapter03/04_Graph_Neural_Network.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"\n",
"sys.path.append(f\"{os.getcwd()}/..\")\n",
"\n",
"from Chapter01.utils import draw_graph, FIGURES_DIR\n",
"from utils import draw_graph, FIGURES_DIR\n",
"\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt"
Expand Down
161 changes: 94 additions & 67 deletions Chapter05/02_community_detection_algorithms.ipynb

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM jupyter/scipy-notebook
FROM jupyter/scipy-notebook as base

ARG user=euler
ARG branch=chap6

USER root

Expand All @@ -16,29 +17,34 @@ ENV NB_USER=${user}
ENV XDG_CACHE_HOME=/home/${user}/.cache/

RUN git clone https://github.com/deusebio/Graph-Machine-Learning.git /home/${user}/Graph-Machine-Learning

WORKDIR /home/${user}/Graph-Machine-Learning
RUN git checkout ${branch}

RUN ln -s /data data
EXPOSE 8888

RUN git checkout chap6
ENTRYPOINT jupyter notebook --no-browser --port 8888 --NotebookApp.token='' --NotebookApp.password=''

FROM base as chap1
RUN ls -d -1 */ | grep -v -e Chapter01 | xargs rm -rf
RUN conda create -n chap1 python=3.9
RUN conda run -n chap1 pip install -r Chapter01/requirements.txt
RUN conda run -n chap1 python -m ipykernel install --name chap1 --user

FROM base as chap2
RUN ls -d -1 */ | grep -v -e Chapter02 | xargs rm -rf
RUN conda create -n chap2 python=3.11
RUN conda run -n chap2 pip install -r Chapter02/requirements.txt
RUN conda run -n chap2 python -m ipykernel install --name chap2 --user

FROM base as chap3
RUN ls -d -1 */ | grep -v -e Chapter03 | xargs rm -rf
RUN conda create -n chap3 python=3.8
RUN conda run -n chap3 pip install -r Chapter03/requirements.txt
RUN conda run -n chap3 python -m ipykernel install --name chap3 --user

FROM base as chap6
RUN ls -d -1 */ | grep -v -e Chapter06 | xargs rm -rf
RUN conda create -n chap6 python=3.8
RUN conda run -n chap6 pip install -r Chapter06/requirements.txt
RUN conda run -n chap6 python -m ipykernel install --name chap6 --user

EXPOSE 8888

ENTRYPOINT jupyter notebook --no-browser --port 8888 --NotebookApp.token='' --NotebookApp.password=''
File renamed without changes.