From 8628b36e3359f2b9a145ee408a1c0949990b2fd8 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 14:54:59 +0200 Subject: [PATCH 01/11] feat: add simple github actions workflow --- .github/workflows/ci-pipeline.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci-pipeline.yaml diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml new file mode 100644 index 0000000..d771426 --- /dev/null +++ b/.github/workflows/ci-pipeline.yaml @@ -0,0 +1,22 @@ +name: Continuous Integration + +# Run only on main and feature branches if Python files were changed +on: + push: + branches: + - main + - 'feature/**' + # Deactivated for testing + # paths: + # - '**.py' + +jobs: + one-job: + runs-on: ubuntu-latest + steps: + - run: echo "This job was automatically triggered by commit ${{ github.sha }}" + + another-job: + runs-on: ubuntu-latest + steps: + - run: echo "Does this run in parallel?" \ No newline at end of file From adfa3099f323acce571e71e82d74d0cae9b1a2e7 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:16:14 +0200 Subject: [PATCH 02/11] wip: update workflow --- .github/workflows/ci-pipeline.yaml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index d771426..5cf5642 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -9,14 +9,35 @@ on: # Deactivated for testing # paths: # - '**.py' + +env: + PYTHON_IMAGE_VERSION: 3.12-slim + POETRY_VERSION: 2.1.2 jobs: - one-job: + # Checkout code + # Setup environment incl. dev dependencies using poetry + # Run pytest (and fail if tests fail?) + unit-tests: + name: Run Unit Tests runs-on: ubuntu-latest + container: python:$PYTHON_IMAGE_VERSION steps: - - run: echo "This job was automatically triggered by commit ${{ github.sha }}" + - name: Debug information + run: echo "This job was automatically triggered by commit ${{ github.sha }}" + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup python environment + run: | + python -m venv /opt/poetry + /opt/poetry/bin/pip install --no-cache-dir poetry==$POETRY_VERSION + ls -lisa / another-job: + name: I will eventually be a useful job runs-on: ubuntu-latest + needs: unit-tests steps: - - run: echo "Does this run in parallel?" \ No newline at end of file + - run: echo "The unit tests were successful!" \ No newline at end of file From f319609013b254bc13a8be3884b259b182907c44 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:21:06 +0200 Subject: [PATCH 03/11] wip: update workflow --- .github/workflows/ci-pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index 5cf5642..8699064 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -21,7 +21,7 @@ jobs: unit-tests: name: Run Unit Tests runs-on: ubuntu-latest - container: python:$PYTHON_IMAGE_VERSION + container: python:${{ env.PYTHON_IMAGE_VERSION }} steps: - name: Debug information run: echo "This job was automatically triggered by commit ${{ github.sha }}" From 15dedfde3e8de1cef724c4a53acbcc295e667afc Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:24:10 +0200 Subject: [PATCH 04/11] wip: update workflow --- .github/workflows/ci-pipeline.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index 8699064..2dd2a53 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -11,7 +11,7 @@ on: # - '**.py' env: - PYTHON_IMAGE_VERSION: 3.12-slim + PYTHON_IMAGE: 'python:3.12-slim' POETRY_VERSION: 2.1.2 jobs: @@ -21,7 +21,7 @@ jobs: unit-tests: name: Run Unit Tests runs-on: ubuntu-latest - container: python:${{ env.PYTHON_IMAGE_VERSION }} + container: ${{ env.PYTHON_IMAGE_VERSION }} steps: - name: Debug information run: echo "This job was automatically triggered by commit ${{ github.sha }}" From 134bc881c8065504d057ba52ac906947e1e43b31 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:28:56 +0200 Subject: [PATCH 05/11] wip: update workflow --- .github/workflows/ci-pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index 2dd2a53..a88a77d 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -21,7 +21,7 @@ jobs: unit-tests: name: Run Unit Tests runs-on: ubuntu-latest - container: ${{ env.PYTHON_IMAGE_VERSION }} + container: python:3.12-slim # TODO: How to use a variable here? steps: - name: Debug information run: echo "This job was automatically triggered by commit ${{ github.sha }}" From f9a0994d43a96db4a0c4e9392860d198ca5e6217 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:35:19 +0200 Subject: [PATCH 06/11] wip: update workflow --- .github/workflows/ci-pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index a88a77d..1a48b2b 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -33,7 +33,7 @@ jobs: run: | python -m venv /opt/poetry /opt/poetry/bin/pip install --no-cache-dir poetry==$POETRY_VERSION - ls -lisa / + ls -lisa $GITHUB_WORKSPACE another-job: name: I will eventually be a useful job From efb85802a4a03d55fdf73e2ba5e1ce126123e30d Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:42:26 +0200 Subject: [PATCH 07/11] wip: update workflow --- .github/workflows/ci-pipeline.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index 1a48b2b..a5f21d6 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -29,11 +29,19 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup python environment + - name: Setup Poetry run: | python -m venv /opt/poetry /opt/poetry/bin/pip install --no-cache-dir poetry==$POETRY_VERSION - ls -lisa $GITHUB_WORKSPACE + + - name: Install Dependencies + run: | + cd $GITHUB_WORKSPACE + /opt/poetry/bin/poetry install --no-root --no-interaction --with=dev + + - name: Run Pytest + run: | + poetry run pytest tests/ -v another-job: name: I will eventually be a useful job From ff6d4564302b72de1b9c4ff0c07007a62dd539e2 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:45:46 +0200 Subject: [PATCH 08/11] wip: update workflow --- .github/workflows/ci-pipeline.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index a5f21d6..09eb916 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -22,6 +22,8 @@ jobs: name: Run Unit Tests runs-on: ubuntu-latest container: python:3.12-slim # TODO: How to use a variable here? + env: + POETRY_HOME: '/opt/poetry' steps: - name: Debug information run: echo "This job was automatically triggered by commit ${{ github.sha }}" @@ -31,17 +33,17 @@ jobs: - name: Setup Poetry run: | - python -m venv /opt/poetry - /opt/poetry/bin/pip install --no-cache-dir poetry==$POETRY_VERSION + python -m venv $POETRY_HOME + $POETRY_HOME/bin/pip install --no-cache-dir poetry==$POETRY_VERSION - name: Install Dependencies run: | cd $GITHUB_WORKSPACE - /opt/poetry/bin/poetry install --no-root --no-interaction --with=dev + $POETRY_HOME/bin/poetry install --no-root --no-interaction --with=dev - name: Run Pytest run: | - poetry run pytest tests/ -v + $POETRY_HOME/bin/poetry run pytest tests/ -v another-job: name: I will eventually be a useful job From d5eaac02af18588298e4f9e38863608f6562e1c1 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:46:45 +0200 Subject: [PATCH 09/11] debug: check test failure --- tests/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_api.py b/tests/test_api.py index ddaf3e2..a240baf 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -27,7 +27,7 @@ def test_get_task_by_id(): Task(id=0, name="Test Task 0"), Task(id=1, name="Test Task 1"), ] - assert get_task_by_id(task_list, 1) == task_list[1] + assert get_task_by_id(task_list, 1) == task_list[0] with pytest.raises(ValueError): get_task_by_id(task_list, 2) From 96fd500f19c5a50a2d6534715441ffab3304c5d9 Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:50:30 +0200 Subject: [PATCH 10/11] Revert "debug: check test failure" This reverts commit d5eaac02af18588298e4f9e38863608f6562e1c1. --- tests/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_api.py b/tests/test_api.py index a240baf..ddaf3e2 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -27,7 +27,7 @@ def test_get_task_by_id(): Task(id=0, name="Test Task 0"), Task(id=1, name="Test Task 1"), ] - assert get_task_by_id(task_list, 1) == task_list[0] + assert get_task_by_id(task_list, 1) == task_list[1] with pytest.raises(ValueError): get_task_by_id(task_list, 2) From f976a83faccda317f65bb790c22d8c3df8f0607a Mon Sep 17 00:00:00 2001 From: Maurice Atrops Date: Sat, 3 May 2025 15:55:52 +0200 Subject: [PATCH 11/11] docs: remove clutter --- .github/workflows/ci-pipeline.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index 09eb916..5b9e300 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -15,9 +15,6 @@ env: POETRY_VERSION: 2.1.2 jobs: - # Checkout code - # Setup environment incl. dev dependencies using poetry - # Run pytest (and fail if tests fail?) unit-tests: name: Run Unit Tests runs-on: ubuntu-latest @@ -25,9 +22,6 @@ jobs: env: POETRY_HOME: '/opt/poetry' steps: - - name: Debug information - run: echo "This job was automatically triggered by commit ${{ github.sha }}" - - name: Checkout repository uses: actions/checkout@v4