Merge pull request #120 from swryan/1.4.20-dev #26
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
name: Test testflo | |
on: | |
# Trigger on push or pull request events for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allow running the workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
permissions: {} | |
jobs: | |
tests: | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# test on Ubuntu | |
- NAME: Ubuntu Baseline | |
OS: ubuntu-latest | |
PY: '3.12' | |
# test on MacOS | |
- NAME: MacOS Baseline | |
OS: macos-latest | |
PY: '3.12' | |
runs-on: ${{ matrix.OS }} | |
name: ${{ matrix.NAME }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.PY }} | |
- name: Install testflo | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
# Enable tmate debugging of manually-triggered workflows if the input option was provided | |
# | |
# To access the terminal through the web-interface: | |
# 1. Click on the web-browser link printed out in this action from the github | |
# workflow terminal | |
# 2. Press cntrl + c in the new tab that opens up to reveal the terminal | |
# 3. To activate the conda environment run: | |
# $ source $CONDA/etc/profile.d/conda.sh | |
# $ conda activate test | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: Run tests | |
run: | | |
cd $HOME | |
testflo testflo.tests -vs --show_skipped --durations=5 --durations-min=0 --deprecations_report dep.txt || RC=$? | |
if [[ $RC -ne 1 ]]; then | |
echo "Expected some tests to fail." | |
exit 1 | |
fi | |
if [[ ! -n `grep "Ran 26 tests" testflo_report.out` ]]; then | |
echo "Expected 26 tests." | |
exit 26 | |
fi | |
if [[ ! -n `grep "Passed: 7" testflo_report.out` ]]; then | |
echo "Expected 7 tests to pass." | |
exit 7 | |
fi | |
if [[ ! -n `grep "Failed: 8" testflo_report.out` ]]; then | |
echo "Expected 8 tests to fail." | |
exit 8 | |
fi | |
if [[ ! -n `grep "Skipped: 11" testflo_report.out` ]]; then | |
echo "Expected 11 tests to be skipped." | |
exit 11 | |
fi | |
grep "Deprecations Report" dep.txt | |
rm dep.txt | |
- name: Run tests in serial | |
run: | | |
cd $HOME | |
testflo testflo.tests -n 1 -vs --show_skipped --durations=5 --durations-min=0 --deprecations_report dep.txt || RC=$? | |
if [[ $RC -ne 1 ]]; then | |
echo "Expected some tests to fail." | |
exit 1 | |
fi | |
if [[ ! -n `grep "Ran 26 tests using 1 processes" testflo_report.out` ]]; then | |
echo "Expected 26 tests on one process." | |
exit 26 | |
fi | |
if [[ ! -n `grep "Passed: 7" testflo_report.out` ]]; then | |
echo "Expected 7 tests to pass." | |
exit 7 | |
fi | |
if [[ ! -n `grep "Failed: 8" testflo_report.out` ]]; then | |
echo "Expected 8 tests to fail." | |
exit 8 | |
fi | |
if [[ ! -n `grep "Skipped: 11" testflo_report.out` ]]; then | |
echo "Expected 11 tests to be skipped." | |
exit 11 | |
fi | |
grep "Deprecations Report" dep.txt | |
rm dep.txt | |
- name: Notify slack of failure | |
uses: act10ns/[email protected] | |
with: | |
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
status: ${{ job.status }} | |
if: failure() |