[MSD-302] Milling pattern spot size correction #4082
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 perform linting on the changed python files of a push or | |
| # pull request and on the full codebase. For the full# codebase it will not fail | |
| # if there are linting errors, for the changed files it will fail. | |
| name: Linting | |
| on: [push, pull_request] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout branch | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v46 | |
| - name: Setup Python environment | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' # As on Ubuntu 24.04 | |
| - name: Install flake8 | |
| run: pip install flake8 | |
| - name: Run flake8 on full codebase | |
| continue-on-error: true | |
| # W291 Trailing whitespace | |
| # W292 No newline at end of file | |
| # W293 Blank line contains whitespace | |
| # W391 Blank line at end of file | |
| # E999 SyntaxError | |
| # (Exclude the automatically generated files) | |
| run: flake8 . --select W291,W292,W293,W391,E999 --exclude src/odemis/gui/main_xrc.py,src/odemis/gui/win/dialog_xrc.py | |
| - name: Run flake8 on changed files | |
| run: | | |
| for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
| if [[ $changed_file == *.py ]] | |
| then | |
| flake8 "$changed_file" --select W291,W292,W293,W391,E999 --exclude src/odemis/gui/main_xrc.py,src/odemis/gui/win/dialog_xrc.py | |
| fi | |
| done | |
| - name: Install pngcheck | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pngcheck | |
| - name: Check PNG files have no metadata | |
| run: | | |
| set -euo pipefail | |
| forbidden_chunks_regex='(tEXt|zTXt|iTXt|eXIf|tIME)' | |
| has_issues=0 | |
| files='${{ steps.changed-files.outputs.all_changed_files }}' | |
| if test -z "$files" | |
| then | |
| echo "No files changed; skipping PNG metadata check." | |
| exit 0 | |
| fi | |
| printf "Files to consider for PNG check:\n%s\n" "$files" | |
| for file in $files | |
| do | |
| # Only consider png files | |
| case "$file" in | |
| *.png|*.PNG) ;; | |
| *) continue ;; | |
| esac | |
| # Skip files that no longer exist (deleted/renamed out of tree) | |
| if test ! -f "$file" | |
| then | |
| echo "Skipping non-existent: $file" | |
| continue | |
| fi | |
| echo "Inspecting: $file" | |
| # pngcheck -v exits non-zero for some structural issues; don't fail the loop on that alone | |
| chunks=$(pngcheck -v "$file" 2>&1 || true) | |
| if echo "$chunks" | grep -E -q "$forbidden_chunks_regex" | |
| then | |
| echo "::error file=$file::Contains forbidden metadata chunks" | |
| echo "$chunks" | grep -E "$forbidden_chunks_regex" || true | |
| has_issues=1 | |
| else | |
| echo "OK: $file has no forbidden metadata chunks" | |
| fi | |
| done | |
| if test "$has_issues" -ne 0 | |
| then | |
| echo "One or more PNG files contain metadata (tEXt, zTXt, iTXt, eXIf or tIME)." | |
| echo "Please strip metadata and commit again. For instance, call: ./util/groom-img.py src/odemis/gui/img/ " | |
| exit 1 | |
| fi |