docs: black, isort #20
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: Tests | |
on: | |
- push | |
- pull_request | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.11'] # Can also test on multiple versions | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r requirements.txt -r requirements_dev.txt | |
pip3 install -e . | |
- name: Run pytest | |
run: | | |
set +e # Do not exit shell on pytest failure | |
out=$(pytest 2> stderr.txt) | |
exit_code=$? | |
err=$(<stderr.txt) | |
# Display the raw output in the step | |
echo "${out}" | |
echo "${err}" | |
# Display the Markdown output in the job summary | |
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY | |
echo "${out}" >> $GITHUB_STEP_SUMMARY | |
echo "${err}" >> $GITHUB_STEP_SUMMARY | |
if [[ $exit_code -eq 5 ]] | |
then | |
echo | |
echo 'WARNING: No tests were run and it is considered as success' >> $GITHUB_STEP_SUMMARY | |
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
exit 0 | |
else | |
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
# Exit with the exit-code returned by pytest | |
exit ${exit_code} | |
fi |