From 4bec18e7b3f09c99bd2a70731d147e9e2a71b87f Mon Sep 17 00:00:00 2001 From: nasc17 <69922333+nasc17@users.noreply.github.com> Date: Fri, 21 Jul 2023 17:46:01 -0400 Subject: [PATCH] Style check for all platforms (#443) * style check all platforms * remove warningpreference from bash * upgrade pip and try mac tests * python3 install pip * update calls * remove pg start and fix style check * add fail on test * remove continue on error * remove failOnStderr * fail check * Revert "fail check" This reverts commit c50e269b99774a91a2fbdd7516fe8c09234e0ce1. --- .pipeline/build-CI.yml | 12 ++++++++---- .pipeline/build_pullrequest.yml | 12 ++++++++---- .pipeline/build_release.yml | 12 ++++++++---- scripts/flake8.sh | 12 ++++++++++++ 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.pipeline/build-CI.yml b/.pipeline/build-CI.yml index d3ec5533..192ad237 100644 --- a/.pipeline/build-CI.yml +++ b/.pipeline/build-CI.yml @@ -100,7 +100,6 @@ jobs: & "$env:BUILD_SOURCESDIRECTORY\scripts\flake8.ps1" warningPreference: stop - failOnStderr: true - task: PowerShell@2 displayName: Run Tests windows condition: eq(variables.platform, 'windows') @@ -108,16 +107,21 @@ jobs: targetType: filePath filePath: ./scripts/test-all.ps1 errorActionPreference: default - continueOnError: true + - task: Bash@3 + displayName: 'Style Check' + condition: ne(variables.platform, 'windows') + inputs: + targetType: filePath + filePath: ./scripts/flake8.sh - task: PublishTestResults@2 displayName: Publish test results windows **/nose2-junit.xml - condition: eq(variables.platform, 'windows') + condition: and(succeededOrFailed(), eq(variables.platform, 'windows')) inputs: testResultsFormat: JUnit testResultsFiles: "**/nose2-junit.xml" - task: PublishCodeCoverageResults@1 displayName: Publish code coverage from **/htmlcov windows - condition: eq(variables.platform, 'windows') + condition: and(succeededOrFailed(), eq(variables.platform, 'windows')) inputs: codeCoverageTool: Cobertura summaryFileLocation: "**/cchtml" diff --git a/.pipeline/build_pullrequest.yml b/.pipeline/build_pullrequest.yml index a7e9c88c..9f0eea96 100644 --- a/.pipeline/build_pullrequest.yml +++ b/.pipeline/build_pullrequest.yml @@ -99,7 +99,6 @@ steps: & "$env:BUILD_SOURCESDIRECTORY\scripts\flake8.ps1" warningPreference: stop - failOnStderr: true - task: PowerShell@2 displayName: Run Tests windows condition: eq(variables.platform, 'windows') @@ -107,16 +106,21 @@ steps: targetType: filePath filePath: ./scripts/test-all.ps1 errorActionPreference: default - continueOnError: true + - task: Bash@3 + displayName: 'Style Check' + condition: ne(variables.platform, 'windows') + inputs: + targetType: filePath + filePath: ./scripts/flake8.sh - task: PublishTestResults@2 displayName: Publish test results windows **/nose2-junit.xml - condition: eq(variables.platform, 'windows') + condition: and(succeededOrFailed(), eq(variables.platform, 'windows')) inputs: testResultsFormat: JUnit testResultsFiles: "**/nose2-junit.xml" - task: PublishCodeCoverageResults@1 displayName: Publish code coverage from **/htmlcov windows - condition: eq(variables.platform, 'windows') + condition: and(succeededOrFailed(), eq(variables.platform, 'windows')) inputs: codeCoverageTool: Cobertura summaryFileLocation: "**/cchtml" diff --git a/.pipeline/build_release.yml b/.pipeline/build_release.yml index 99b8c387..4e18b652 100644 --- a/.pipeline/build_release.yml +++ b/.pipeline/build_release.yml @@ -101,7 +101,6 @@ jobs: & "$env:BUILD_SOURCESDIRECTORY\scripts\flake8.ps1" warningPreference: stop - failOnStderr: true - task: PowerShell@2 displayName: Run Tests windows condition: eq(variables.platform, 'windows') @@ -109,16 +108,21 @@ jobs: targetType: filePath filePath: ./scripts/test-all.ps1 errorActionPreference: default - continueOnError: true + - task: Bash@3 + displayName: 'Style Check' + condition: ne(variables.platform, 'windows') + inputs: + targetType: filePath + filePath: ./scripts/flake8.sh - task: PublishTestResults@2 displayName: Publish test results windows **/nose2-junit.xml - condition: eq(variables.platform, 'windows') + condition: and(succeededOrFailed(), eq(variables.platform, 'windows')) inputs: testResultsFormat: JUnit testResultsFiles: "**/nose2-junit.xml" - task: PublishCodeCoverageResults@1 displayName: Publish code coverage from **/htmlcov windows - condition: eq(variables.platform, 'windows') + condition: and(succeededOrFailed(), eq(variables.platform, 'windows')) inputs: codeCoverageTool: Cobertura summaryFileLocation: "**/cchtml" diff --git a/scripts/flake8.sh b/scripts/flake8.sh index 7422df00..313ea3c3 100755 --- a/scripts/flake8.sh +++ b/scripts/flake8.sh @@ -5,6 +5,18 @@ then exit 1 fi +# Function to check if a command is available +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +python3 -m pip install --upgrade pip --no-warn-script-location +# Install flake8 if it's missing +if ! command_exists flake8; then + echo "flake8 not found. Installing flake8..." + pip3 install flake8 --no-warn-script-location +fi + flake8 --max-line-length=160 --ignore W605,W503,W504 --builtins psycopg,ossdbtoolsservice,View ossdbtoolsservice flake8 --max-line-length=160 --ignore W605,W503,W504 --builtins psycopg,ossdbtoolsservice,View tests flake8 --max-line-length=160 --ignore W605,W503,W504 --builtins psycopg,ossdbtoolsservice,View pgsmo