diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app-dev.yml similarity index 64% rename from .github/workflows/python-app.yml rename to .github/workflows/python-app-dev.yml index dd271d8b..7382b5c2 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app-dev.yml @@ -1,13 +1,11 @@ # 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 +name: Python application - DEV on: push: branches: [ "dev" ] - pull_request: - branches: [ "dev" ] permissions: contents: read @@ -19,21 +17,23 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set up Python 3.7.x uses: actions/setup-python@v3 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: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - #flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with unittest run: | - python -m unittest discover Tests/test_NAL/ -p "test_*.py" -v + python -m unittest discover Tests/test_NAL/ -p "test_*.py" -v &> output-dev.txt + + - uses: actions/upload-artifact@v4 + with: + name: test-report + path: ./output-dev.txt diff --git a/.github/workflows/python-app-pr.yml b/.github/workflows/python-app-pr.yml new file mode 100644 index 00000000..503b7083 --- /dev/null +++ b/.github/workflows/python-app-pr.yml @@ -0,0 +1,57 @@ +# 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 + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.7.x + uses: actions/setup-python@v3 + 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 + run: | + python -m unittest discover Tests/test_NAL/ -p "test_*.py" -v &> 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: Setup Node (for diff) + uses: actions/setup-node@v4 + with: + node-version: 18 + - run: npm install -g diff2html-cli + + - name: Compare test results + run: | + diff -u ./test-report/output-dev.txt output-pr.txt | diff2html -i stdin -F test-diff.html + + - uses: actions/upload-artifact@v4 + with: + name: test-diff + path: ./test-diff.html + +