Skip to content

Commit

Permalink
Style check for all platforms (#443)
Browse files Browse the repository at this point in the history
* 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 c50e269.
  • Loading branch information
nasc17 authored Jul 21, 2023
1 parent 35219a9 commit 4bec18e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
12 changes: 8 additions & 4 deletions .pipeline/build-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,28 @@ jobs:
& "$env:BUILD_SOURCESDIRECTORY\scripts\flake8.ps1"
warningPreference: stop
failOnStderr: true
- task: PowerShell@2
displayName: Run Tests windows
condition: eq(variables.platform, 'windows')
inputs:
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"
Expand Down
12 changes: 8 additions & 4 deletions .pipeline/build_pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,28 @@ steps:
& "$env:BUILD_SOURCESDIRECTORY\scripts\flake8.ps1"
warningPreference: stop
failOnStderr: true
- task: PowerShell@2
displayName: Run Tests windows
condition: eq(variables.platform, 'windows')
inputs:
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"
Expand Down
12 changes: 8 additions & 4 deletions .pipeline/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,28 @@ jobs:
& "$env:BUILD_SOURCESDIRECTORY\scripts\flake8.ps1"
warningPreference: stop
failOnStderr: true
- task: PowerShell@2
displayName: Run Tests windows
condition: eq(variables.platform, 'windows')
inputs:
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"
Expand Down
12 changes: 12 additions & 0 deletions scripts/flake8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4bec18e

Please sign in to comment.