Tagging und Kategorisieren auftrennen #127
Workflow file for this run
This file contains hidden or 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
| # 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 | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| PyTest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest | |
| pip install -r requirements.txt | |
| pip install -r tests/requirements.txt | |
| - name: Test with pytest | |
| run: | | |
| set +e | |
| test_output="$(PYTHONPATH=. pytest -rN)" | |
| exitcode=$? | |
| test_failed=$(sed -n '$s/^=*\s*\([0-9]*\)\sfailed.*/\1/p' <<< "$test_output" |tail -n1) | |
| if [[ -z $test_failed ]]; then test_failed=0 ; fi | |
| test_passed=$(sed -n -E 's|^=*\s([0-9]+\sfailed,\s)?(([0-9]*)\spassed,\s)?.*|\3|p' <<< "$test_output" | tail -n1) | |
| if [[ -z $test_passed ]]; then test_passed=0 ; fi | |
| test_skipped=$(tail -n1 <<< "$test_output" | rev |sed -E 's|^(.*deppiks\s([0-9]*))?.*|\2|') | |
| if [[ -z $test_skipped ]]; then echo test_skipped=0 ; fi | |
| all_tests=$(expr ${test_passed} + ${test_failed}) | |
| echo "### Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| :checkered_flag: | :arrow_right_hook: | :x: |" >> $GITHUB_STEP_SUMMARY | |
| echo "| ------------- | ------------- | ------------- |" >> $GITHUB_STEP_SUMMARY | |
| echo "| $test_passed | $test_skipped | $test_failed |" >> $GITHUB_STEP_SUMMARY | |
| echo "$test_output" | |
| if [[ $exitcode != 0 ]]; then | |
| exit $exitcode | |
| fi | |
| exit 0 | |
| PyLint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pylint | |
| pip install -r requirements.txt | |
| pip install -r tests/requirements.txt | |
| - name: Lint with PyLint | |
| id: linting | |
| run: | | |
| set +e | |
| # | |
| # -- Lint and parse Output | |
| # | |
| pylint_output=$(PYTHONPATH=. pylint . --recursive=y --disable=W0511,R0903 --score=y) | |
| exitcode=$? | |
| score=$(sed -n '$s/[^0-9]*\([0-9.]*\).*/\1/p' <<< "$pylint_output") | |
| # | |
| # -- Exitcode and Summary | |
| # | |
| echo "$pylint_output" | |
| if [[ $exitcode -eq 0 ]]; then | |
| echo "### :sparkles: Excellent! :rocket: **${score} / 10**" >> $GITHUB_STEP_SUMMARY | |
| exit 0 | |
| elif \ | |
| [[ $exitcode -ge 8 && $exitcode -le 15 ]] || \ | |
| [[ $exitcode -ge 17 && $exitcode -le 24 ]]; then | |
| echo "### :shushing_face: tolerated (code: ${exitcode}) - **${score} / 10**" >> $GITHUB_STEP_SUMMARY | |
| exit 0 | |
| else | |
| echo "### :no_entry: Too many linting errors! - **${score} / 10**" >> $GITHUB_STEP_SUMMARY | |
| exit $exitcode | |
| fi |