Skip to content

PR-checker.yml - change the scripts-internal address #19

PR-checker.yml - change the scripts-internal address

PR-checker.yml - change the scripts-internal address #19

Workflow file for this run

name: PR-checker
on: push
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: izuma-system-tests-'${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
static-checks:
runs-on: ubuntu-latest
env:
SUMMARY_FILE: summary.log
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Clone scripts-internal
uses: actions/checkout@v4
with:
repository: PelionIoT/scripts-internal
token: ${{ secrets.ACCESS_TOKEN }}
# Need to run this 1st, so that the other log files do not cause unnecessary findings
- name: Run misspell
if: always()
run: |
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
bin/misspell -i mosquitto . >misspell.log
echo "## Summary" >>$SUMMARY_FILE
echo "### misspell" >>$SUMMARY_FILE
cat misspell.log >>$SUMMARY_FILE
bin/misspell -error -i mosquitto .
lines=$(wc -l < "misspell.log")
if [[ $lines -gt 0 ]]; then
echo "Misspell has findings, fail."
echo "TEST_FAIL=true" >> $GITHUB_ENV
exit 1
else
echo "No findings." >>$SUMMARY_FILE
fi
- name: Run pylint (findings may not increase)
run: |
sudo apt-get install pylint
pylint --version
pylint --exit-zero --persistent=n tests/ izuma_systest_lib/ >pylint.log
echo "### pylint" >>$SUMMARY_FILE
pylintstats=$(scripts-internal/ci/more-lines-checker.sh ${{ github.event.repository.default_branch }} ${{ github.ref_name }} "pylint --exit-zero --persistent=n systemtest-library test_cases" | tail -n2)
echo "$pylintstats" >>$SUMMARY_FILE
pylintscore=$(tail -2 pylint.log |head -1)
echo "$pylintscore" >>$SUMMARY_FILE
echo "$pylintstats"
if [[ $pylintstats == *"Oh no"* ]]; then
# More findings than earlier
echo "TEST_FAIL=true" >> $GITHUB_ENV
exit 1
fi
- name: Run flake8
if: always()
run: |
sudo apt-get install flake8
flake8 --version
echo "Starting flake8..."
flake8 --exit-zero --exclude=izuma_systest_lib/.eggs,scripts-internal --max-line-length=130 >flake8.log
echo "### flake8" >>$SUMMARY_FILE
lines=$(wc -l < "flake8.log")
if [[ $lines -gt 0 ]]; then
echo "Flake8 has findings, fail."
echo "TEST_FAIL=true" >> $GITHUB_ENV
exit 1
else
echo "No findings." >>$SUMMARY_FILE
fi
- name: Archive production artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: Findings logs
path: |
*.log
- name: Summary
if: always()
run: cat $SUMMARY_FILE >>$GITHUB_STEP_SUMMARY
- name: Set whole job status based on found fails
if: always()
run: |
if [ "$TEST_FAIL" = "true" ]; then
echo "Some test has failed, fail the job."
exit 1 # You can choose to exit with success (0) to mark this step as successful but skipped.
fi