This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI Check against
tensorflow
include guard (#204)
* Smoke test for include guard * Force pip uninstall * Add step to confirm result
- Loading branch information
1 parent
224e0b3
commit 0dc6878
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Test Tensorflow include guards | ||
# These tests check that the include guards checking for tensorflow's availability | ||
# behave as expected on ubuntu and macOS. | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
tensorflow_guards: | ||
name: Test include guards | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install via pip | ||
run: python -m pip install -e . | ||
|
||
- name: Test (working) import | ||
uses: jannekem/run-python-script-action@v1 | ||
with: | ||
fail-on-error: true | ||
script: | | ||
import cellfinder_core | ||
- name: Uninstall tensorflow | ||
run: python -m pip uninstall -y tensorflow | ||
|
||
- name: Test (broken) import | ||
id: broken_import | ||
uses: jannekem/run-python-script-action@v1 | ||
with: | ||
fail-on-error: false | ||
script: | | ||
import cellfinder_core | ||
# exit 1 will force an actions exit with a failure reported | ||
- name: Flag error thrown by broken import | ||
if: steps.broken_import.outputs.error == 'false' | ||
run: | | ||
echo "Broken import test result was: ${{ steps.broken_import.outputs.error }}" | ||
exit 1 | ||
# add an additional step to confirm an error occurred in the import | ||
- name: Confirm error was thrown by broken import | ||
if: steps.broken_import.outputs.error == 'true' | ||
run: | | ||
echo "Broken import test result was: ${{ steps.broken_import.outputs.error }}" |