NAS-137693 / 25.10.0 / Moving tn_connect urls from staging to production #19766
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
name: flake8 | |
on: | |
pull_request: | |
types: | |
- 'synchronize' | |
- 'opened' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check illegal patterns | |
run: | | |
if grep -r "Literal\[None\]" src/middlewared/middlewared/api/; then | |
echo "❌ Literal[None] usage found in middlewared/api/. Use None instead." | |
exit 1 | |
else | |
echo "✅ No Literal[None] usage found in middlewared/api/" | |
fi | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 flake8-builtins flake8-tidy-imports flake8-literal | |
- name: Get current errors | |
run: | | |
tmpafter=$(mktemp) | |
find src -name \*.py -exec flake8 --config=src/middlewared/setup.cfg {} + | egrep -v "alembic/versions/|usr/local/share/pysnmp/mibs/" > $tmpafter | |
num_errors_after=`cat $tmpafter | wc -l` | |
echo "CURRENT_ERROR_FILE=${tmpafter}" >> $GITHUB_ENV | |
echo "CURRENT_ERRORS=${num_errors_after}" >> $GITHUB_ENV | |
- name: Checkout base branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Get errors from base branch | |
run: | | |
tmpbefore=$(mktemp) | |
find src -name \*.py -exec flake8 --config=src/middlewared/setup.cfg {} + | egrep -v "alembic/versions/|usr/local/share/pysnmp/mibs/" > $tmpbefore | |
num_errors_before=`cat $tmpbefore | wc -l` | |
echo "OLD_ERROR_FILE=${tmpbefore}" >> $GITHUB_ENV | |
echo "OLD_ERRORS=${num_errors_before}" >> $GITHUB_ENV | |
- name: Conclusion | |
run: | | |
if [ ${{ env.CURRENT_ERRORS }} -gt ${{ env.OLD_ERRORS }} ]; then | |
echo "New flake8 errors were introduced" | |
diff -u ${{ env.OLD_ERROR_FILE }} ${{ env.CURRENT_ERROR_FILE }} | |
exit 1 | |
else | |
echo "No new flake 8 errors were introduced" | |
fi |