diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml new file mode 100644 index 0000000..e1c0df7 --- /dev/null +++ b/.github/workflows/python-ci.yml @@ -0,0 +1,39 @@ + +name: POSM Pipeline CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: 'pip' + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install ruff pytest + # pip install -r requirements.txt (Uncomment when you add this file) + + - name: Lint and Format with Ruff + run: | + # Fails the build if there are syntax errors or undefined names + ruff check . + # Fails the build if the code is not formatted properly + ruff format --check . + + - name: Run Unit Tests + run: | + pytest tests/ \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3b8ce0d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.11-slim + +WORKDIR /app + +COPY requirements.txt . + +RUN pip install --upgrade pip && \ + pip install -r requirements.txt + +COPY . . + +CMD ["python", "scripts/run_pipeline.py"] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2773801 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.ruff] +# Set the maximum line length +line-length = 100 +# Assume Python 3.11 +target-version = "py311" + +[tool.ruff.lint] +# E: pycodestyle errors, F: Pyflakes (syntax errors), I: isort (import sorting) +select = ["E", "F", "I"] + +[tool.pytest.ini_options] +# Define where the test suite lives +testpaths = ["tests"] +# Add detailed output to the test logs +addopts = "-v" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6e31701 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +ruff +pytest \ No newline at end of file diff --git a/scripts/run_pipeline.py b/scripts/run_pipeline.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/__pycache__/mock_test.cpython-313-pytest-8.3.5.pyc b/tests/__pycache__/mock_test.cpython-313-pytest-8.3.5.pyc new file mode 100644 index 0000000..848fa7c Binary files /dev/null and b/tests/__pycache__/mock_test.cpython-313-pytest-8.3.5.pyc differ diff --git a/tests/mock_test.py b/tests/mock_test.py new file mode 100644 index 0000000..bbca82c --- /dev/null +++ b/tests/mock_test.py @@ -0,0 +1,6 @@ +def test_placeholder(): + """ + A temporary placeholder test to ensure the GitHub Actions CI pipeline + runs successfully. Real pipeline tests will be added here later. + """ + assert True