Skip to content

Commit

Permalink
Add first version of GitHub Actions CI/CD pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kurz committed Oct 1, 2024
1 parent efdbc27 commit e80ffe9
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 5 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI/CD Pipeline

on:
push:
branches:
- '*' # Run on all branches
pull_request:
branches:
- main

jobs:
lint:
name: Linter
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Run pylint
run: |
pylint --fail-under=7 gcnn/
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Run unit tests
run: |
pytest --cov=gcnn/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
6 changes: 3 additions & 3 deletions gcnn/layers/graph_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import tensorflow as tf


class GraphConv(tf.keras.layers.Layer):
class GraphConv(tf.keras.layers.Layer): # pylint: disable=no-member
"""Implements a Graph-Convolutional layer.
Implements a single Graph-Convolutional layer following:
Expand Down Expand Up @@ -117,8 +117,8 @@ def kernel_initializer(self) -> str:
def kernel_initializer(self, kernel_initializer: str):
"""Set requested initializer if it is implemented in TensorFlow."""
initializer_list = []
for name, obj in inspect.getmembers(tf.keras.initializers):
if inspect.isclass(obj) and issubclass(obj, tf.keras.initializers.Initializer):
for name, obj in inspect.getmembers(tf.keras.initializers): # pylint: disable=no-member
if inspect.isclass(obj) and issubclass(obj, tf.keras.initializers.Initializer): # pylint: disable=no-member
initializer_list.append(name)
if kernel_initializer not in initializer_list:
raise ValueError(f'Invalid initializer {kernel_initializer}. Available are: {initializer_list}')
Expand Down
2 changes: 1 addition & 1 deletion gcnn/layers/graph_readout.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import tensorflow as tf


class GraphReadout(tf.keras.layers.Layer):
class GraphReadout(tf.keras.layers.Layer): # pylint: disable=no-member
'''Implements a graph readout layer using TensorFlow.
Implements a graph readout layer, also called (flat) graph pooling layer,
Expand Down
1 change: 0 additions & 1 deletion gcnn/utils/grid_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def visualize_graph(dims: np.ndarray):
dims = np.append(dims, (1,))

edge_list = GridGraph.get_edge_list(dims)
adj_matrix = GridGraph.get_adjacency_matrix(dims)

coordinates = []
for index in np.ndindex(*dims):
Expand Down

0 comments on commit e80ffe9

Please sign in to comment.