Skip to content

Commit

Permalink
Added new workflow file for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydhamilton committed Feb 26, 2024
1 parent d251f60 commit 88aac37
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_push_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Build and Push Docker Image"
on:
workflow_dispatch:
workflow_call:
inputs:
DOCKER_FILEPATH:
description: "The path dockerfile."
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image with version tag
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/continuous_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CI

on:
workflow_dispatch:

jobs:
unit-tests:
name: Run Unit Tests
uses: .github/workflows/pytest.yaml@main
docker-build:
needs: unit-tests
name: Build Docker Image
uses: .github/workflows/build_push_docker.yaml@main
35 changes: 35 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Build and Push Docker Image"
on:
workflow_call:

jobs:
pytest:
name: "Build and Push Docker Image"
runs-on: ubuntu-latest
steps:
- name: "Set up poetry python"
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.10
- name: "Install Poetry"
uses: snok/install-poetry@v1
with:
installer-parallel: true
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install poetry dependencies
shell: bash
run: |
poetry install --no-interaction --no-root
- name: "Run pytest"
run: |
poetry --version
source .venv/bin/activate
python -m pytest
Empty file added custom_predictor/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions tests/example_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from custom_predictor.dummy_model import DummyModel


class TestCustomPredictor:
def test_custom_predictor(self):
pass

def test_dummy_model(self):
model = DummyModel()
assert isinstance(model, DummyModel)

0 comments on commit 88aac37

Please sign in to comment.