From 888da8274c96c4b27053f7797a45075cccbf1f88 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Wed, 4 Nov 2020 15:43:27 +0000 Subject: [PATCH] GHA build tweak --- .github/workflows/sample_build.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sample_build.yml b/.github/workflows/sample_build.yml index 6dc8de88..47a73f9f 100644 --- a/.github/workflows/sample_build.yml +++ b/.github/workflows/sample_build.yml @@ -26,20 +26,26 @@ jobs: run: | python -m test.test_projects test.test_testing.project_with_a_test sample_project - - name: Build wheels - if: matrix.result == 'success' - run: | - cd sample_project - python -m cibuildwheel --output-dir wheelhouse - - - name: Build wheels [expected failure] + - name: Add a failing test if: matrix.result == 'failure' run: | cd sample_project - # adjust the project to cause an error echo ' class AnotherTest: def test_something(self): self.fail("sabotage!") ' >> test/spam_test.py - python -m cibuildwheel --output-dir wheelhouse || true + + - name: Build & test wheels + run: | + cd sample_project + if $should_fail; then + # prefix with ! to expect failure + ! python -m cibuildwheel --output-dir wheelhouse + else + python -m cibuildwheel --output-dir wheelhouse + fi + env: + CIBW_TEST_COMMAND: nosetests {project}/test + CIBW_TEST_REQUIRES: nose + should_fail: ${{ matrix.result == 'failure' }}