Skip to content

[WIP] testing workflows #27

[WIP] testing workflows

[WIP] testing workflows #27

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application - PR
on:
pull_request:
branches: [ "dev" ]
permissions:
contents: read
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.7.x
uses: actions/setup-python@v5
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with unittest
continue-on-error: true
run: |
python -m unittest discover Tests/test_NAL/ -p "test_*.py" -v |& tee output-pr.txt
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v3.0.0
with:
workflow: python-app-dev.yml
name: test-report
- name: Extract number of failures and errors
run: |
tr '\r' '\n' < output-dev.txt > old.txt
tr '\r' '\n' < output-pr.txt > new.txt
tail -n +53 old.txt > tmp.txt && mv tmp.txt old.txt
tail -n +53 new.txt > tmp.txt && mv tmp.txt new.txt
sed -n '/=============/q;p' old.txt
sed -n '/=============/q;p' new.txt
{
echo "TEST_RESULTS<<EOF"
diff -u old.txt new.txt || true
echo EOF
} >> "$GITHUB_ENV"
- name: Update build summary
run: |
printf '%s\n' "\`\`\`diff\n$TEST_RESULTS\n\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Comment on the PR
uses: thollander/actions-comment-pull-request@v2.4.3
with:
message: |
```diff
${{ env.TEST_RESULTS }}
```
comment_tag: execution