From 9c43ba73904bf73e8d9bfc3258686c209bc29dbe Mon Sep 17 00:00:00 2001 From: David Waroquiers Date: Fri, 17 Jan 2025 13:20:14 +0100 Subject: [PATCH 1/7] Testing continue on error and failure in workflow. --- .github/workflows/testing.yml | 179 +++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 81 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index ad3b720d..00268429 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -69,89 +69,106 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: pip - cache-dependency-path: pyproject.toml - - - name: Install mongo-tools - run: | - wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.10.0.deb - sudo apt install ./mongodb-database-tools-*-100.10.0.deb - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Load test bench containers - uses: docker/bake-action@v6 - with: - load: true - files: tests/integration/dockerfiles/docker-bake.hcl - set: | - *.cache-from=type=gha,scope=global - - - name: Install dependencies +# - uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# cache: pip +# cache-dependency-path: pyproject.toml +# +# - name: Install mongo-tools +# run: | +# wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.10.0.deb +# sudo apt install ./mongodb-database-tools-*-100.10.0.deb +# +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# +# - name: Load test bench containers +# uses: docker/bake-action@v6 +# with: +# load: true +# files: tests/integration/dockerfiles/docker-bake.hcl +# set: | +# *.cache-from=type=gha,scope=global +# +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install -r requirements/requirements.txt +# pip install .[tests] + + # Testing save db artifact + - name: Testing the save db artifact in case a test fails + id: failure run: | - python -m pip install --upgrade pip - pip install -r requirements/requirements.txt - pip install .[tests] + echo "Forcing a failure in this step" + exit 1 + continue-on-error: true - - name: Unit tests + - name: Make sure the previous step has failed + if: ${{ steps.failure.outcome == 'success' }} run: | - COVERAGE_FILE=.coverage.1 \ - pytest \ - --pytest-durations-min=1 \ - --cov=jobflow_remote --cov-report= --cov-config pyproject.toml \ - --ignore tests/integration \ + exit 1 - - name: Integration tests + - name: Check the dump of the db run: | - COVERAGE_FILE=.coverage.2 \ - pytest \ - --pytest-durations-min=1 \ - --cov=jobflow_remote --cov-report= --cov-config pyproject.toml \ - tests/integration - - # combining the reports with --cov-append did not seem to work - - name: Generate coverage report - run: | - coverage combine .coverage.1 .coverage.2 - coverage xml - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - docs: - name: Build documentation - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install docs dependencies - run: | - python -m pip install -U pip - pip install -U setuptools wheel - # Required to generate rst files from markdown - sudo apt install pandoc - pip install -r requirements/requirements.txt - pip install .[docs] - - - name: Build Sphinx docs - working-directory: doc - run: | - # cannot use sphinx build directly as the makefile handles generation - # of some rst files - make html + echo "Checking db dump" + +# - name: Unit tests +# run: | +# COVERAGE_FILE=.coverage.1 \ +# pytest \ +# --pytest-durations-min=1 \ +# --cov=jobflow_remote --cov-report= --cov-config pyproject.toml \ +# --ignore tests/integration \ +# +# - name: Integration tests +# run: | +# COVERAGE_FILE=.coverage.2 \ +# pytest \ +# --pytest-durations-min=1 \ +# --cov=jobflow_remote --cov-report= --cov-config pyproject.toml \ +# tests/integration +# +# # combining the reports with --cov-append did not seem to work +# - name: Generate coverage report +# run: | +# coverage combine .coverage.1 .coverage.2 +# coverage xml +# +# - name: Upload coverage reports to Codecov +# uses: codecov/codecov-action@v5 +# env: +# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} +# +# docs: +# name: Build documentation +# runs-on: ubuntu-latest +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 +# with: +# submodules: true +# fetch-depth: 0 +# +# - name: Set up Python 3.11 +# uses: actions/setup-python@v5 +# with: +# python-version: '3.11' +# +# - name: Install docs dependencies +# run: | +# python -m pip install -U pip +# pip install -U setuptools wheel +# # Required to generate rst files from markdown +# sudo apt install pandoc +# pip install -r requirements/requirements.txt +# pip install .[docs] +# +# - name: Build Sphinx docs +# working-directory: doc +# run: | +# # cannot use sphinx build directly as the makefile handles generation +# # of some rst files +# make html From a1b957a04efcc3bf670b4173a993984769707b3d Mon Sep 17 00:00:00 2001 From: David Waroquiers Date: Fri, 17 Jan 2025 13:25:43 +0100 Subject: [PATCH 2/7] Test... --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 00268429..2cff46b5 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -102,7 +102,7 @@ jobs: id: failure run: | echo "Forcing a failure in this step" - exit 1 +# exit 1 continue-on-error: true - name: Make sure the previous step has failed From d522c77d56f436984c56fe19a8e8081a91651304 Mon Sep 17 00:00:00 2001 From: David Waroquiers Date: Fri, 17 Jan 2025 13:26:13 +0100 Subject: [PATCH 3/7] Test --- .github/workflows/testing.yml | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2cff46b5..b980f5bf 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -34,32 +34,32 @@ jobs: - name: Lint run: pre-commit run --all-files --show-diff-on-failure - build-test-bench: - name: "Build test bench containers" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build test bench container - uses: docker/bake-action@v6 - with: - load: true - files: tests/integration/dockerfiles/docker-bake.hcl - set: | - *.cache-to=type=gha,scope=global,mode=max - *.cache-from=type=gha,scope=global +# build-test-bench: +# name: "Build test bench containers" +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# +# - name: Build test bench container +# uses: docker/bake-action@v6 +# with: +# load: true +# files: tests/integration/dockerfiles/docker-bake.hcl +# set: | +# *.cache-to=type=gha,scope=global,mode=max +# *.cache-from=type=gha,scope=global test: - services: - local_mongodb: - image: mongo:5.0 - ports: - - 27017:27017 - - needs: [build-test-bench] +# services: +# local_mongodb: +# image: mongo:5.0 +# ports: +# - 27017:27017 +# +# needs: [build-test-bench] runs-on: ubuntu-latest strategy: fail-fast: false From 932e2ce801337d6c8047d825ebfaae311ccafb7b Mon Sep 17 00:00:00 2001 From: David Waroquiers Date: Fri, 17 Jan 2025 13:30:52 +0100 Subject: [PATCH 4/7] Test --- .github/workflows/testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b980f5bf..233c4019 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -102,12 +102,13 @@ jobs: id: failure run: | echo "Forcing a failure in this step" -# exit 1 + exit 1 continue-on-error: true - name: Make sure the previous step has failed if: ${{ steps.failure.outcome == 'success' }} run: | + echo "The previous step with an explicit failure should have failed while it succeeded" exit 1 - name: Check the dump of the db From 8e5b0a338f95aabd682fd7f2c6b12882ebb24d1e Mon Sep 17 00:00:00 2001 From: David Waroquiers Date: Fri, 17 Jan 2025 13:37:07 +0100 Subject: [PATCH 5/7] Test --- .github/workflows/testing.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 233c4019..0d4d9189 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -98,6 +98,8 @@ jobs: # pip install .[tests] # Testing save db artifact + # Should be adapted to have a "real" fake failure from jobflow remote so that + # a "real" jfr db is dumped and can be checked - name: Testing the save db artifact in case a test fails id: failure run: | @@ -105,12 +107,15 @@ jobs: exit 1 continue-on-error: true + # Ensure previous test indeed failed (it continues on error but also continues on success ...) - name: Make sure the previous step has failed if: ${{ steps.failure.outcome == 'success' }} run: | echo "The previous step with an explicit failure should have failed while it succeeded" exit 1 + # This should check that a dump has been created in the github workspace, check its content (?) + # and then remove it - name: Check the dump of the db run: | echo "Checking db dump" From e8e3d5e696ebe9af1214737754a2a86fd75e4599 Mon Sep 17 00:00:00 2001 From: David Waroquiers Date: Fri, 17 Jan 2025 14:20:16 +0100 Subject: [PATCH 6/7] Test --- .github/workflows/testing.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 0d4d9189..524a941c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -107,12 +107,12 @@ jobs: exit 1 continue-on-error: true - # Ensure previous test indeed failed (it continues on error but also continues on success ...) - - name: Make sure the previous step has failed - if: ${{ steps.failure.outcome == 'success' }} - run: | - echo "The previous step with an explicit failure should have failed while it succeeded" - exit 1 +# # Ensure previous test indeed failed (it continues on error but also continues on success ...) +# - name: Make sure the previous step has failed +# if: ${{ steps.failure.outcome == 'success' }} +# run: | +# echo "The previous step with an explicit failure should have failed while it succeeded" +# exit 1 # This should check that a dump has been created in the github workspace, check its content (?) # and then remove it From 6ebea483fc064b2f6b5e5d6d5ba26e7f1b620ebc Mon Sep 17 00:00:00 2001 From: David Waroquiers Date: Fri, 17 Jan 2025 14:20:56 +0100 Subject: [PATCH 7/7] Test --- .github/workflows/testing.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 524a941c..0d4d9189 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -107,12 +107,12 @@ jobs: exit 1 continue-on-error: true -# # Ensure previous test indeed failed (it continues on error but also continues on success ...) -# - name: Make sure the previous step has failed -# if: ${{ steps.failure.outcome == 'success' }} -# run: | -# echo "The previous step with an explicit failure should have failed while it succeeded" -# exit 1 + # Ensure previous test indeed failed (it continues on error but also continues on success ...) + - name: Make sure the previous step has failed + if: ${{ steps.failure.outcome == 'success' }} + run: | + echo "The previous step with an explicit failure should have failed while it succeeded" + exit 1 # This should check that a dump has been created in the github workspace, check its content (?) # and then remove it