diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 5faa7d9..068cd10 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -12,15 +12,19 @@ on: jobs: build: if: "!contains(github.event.head_commit.message, 'skip ci')" - + strategy: + matrix: + python_version: [3.7,3.8] + + fail-fast: true runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.7 + - name: Set up Python ${{ matrix.python_version }} uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: ${{ matrix.python_version }} - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index ff1a45e..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,114 +0,0 @@ -# Python package - -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python - -trigger: - branches: - include: - - master - -pool: - vmImage: 'ubuntu-latest' -strategy: - matrix: - Python36: - python.version: '3.6' - Python37: - python.version: '3.7' - -steps: -- task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' - -- script: | - echo "Getting version from the setup.py file..." - ApplicationVersion=$(cat setup.py | grep version | cut -d '=' -f 2 | cut -d "'" -f 2) - echo "setup.py file version: $ApplicationVersion" - echo "Testing if this version already exists in GitHub..." - echo "Get the tags first..." - tags=$(curl https://api.github.com/repos/gcarrarom/kubeconfig-cleaner-cli/tags) - - echo "check if there's a match on the version.." - Match=$(echo $tags | jq -r ".[] | select(.name == \"v$ApplicationVersion\")") - - if [[ -z "$Match" ]]; then - echo "All good, this doesn't match any old versions" - else - echo "Nope, we have this already... try choosing another one ;)" - exit 100 - fi - - echo "Version to be used: $ApplicationVersion" - echo "##vso[task.setvariable variable=ApplicationVersion]$ApplicationVersion" - displayName: 'Get application Version' - -- script: | - python -m pip install --upgrade pip - pip install pytest-cov - pip install . - pip install testfixtures - pip install mock - displayName: 'Install dependencies' - -- script: | - pip install pytest pytest-azurepipelines - pytest --junitxml=$(System.DefaultWorkingDirectory)/testResults.xml --cov=kcleaner --cov-report=html --cov-report=xml - displayName: 'pytest' - -- task: PublishTestResults@2 - displayName: 'Publish test results' - inputs: - testResultsFiles: '$(System.DefaultWorkingDirectory)/testResults.xml' - testRunTitle: Tests - -- task: PublishCodeCoverageResults@1 - displayName: "publishing code coverage" - inputs: - codeCoverageTool: 'Cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/test-cov.xml' - reportDirectory: '$(System.DefaultWorkingDirectory)/htmlcov' - additionalCodeCoverageFiles: '$(System.DefaultWorkingDirectory)/htmlcov/**' - failIfCoverageEmpty: true - -- task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: '*.py' - TargetFolder: '$(Build.ArtifactStagingDirectory)/code' - CleanTargetFolder: true - displayName: 'Copying Python files to the Staging directory' - -- task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: 'README.MD' - TargetFolder: '$(Build.ArtifactStagingDirectory)/code' - CleanTargetFolder: true - displayName: 'Copying ReadMe.md file to the Staging directory' - -- task: ArchiveFiles@2 - inputs: - rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/code' - includeRootFolder: true - archiveType: 'tar' - archiveFile: '$(Build.ArtifactStagingDirectory)/drop/kcleaner-v$(ApplicationVersion)-$(Build.BuildNumber).tar.gz' - replaceExistingArchive: true - displayName: 'Archiving release files to tar.gz file' - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/drop' - ArtifactName: 'drop' - publishLocation: 'Container' - displayName: 'Publishing Drop Artifacts' - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/code' - ArtifactName: 'code' - publishLocation: 'Container' - displayName: 'Publishing Code Artifacts' diff --git a/kcleaner.py b/kcleaner.py index ff9f8cd..63612d6 100755 --- a/kcleaner.py +++ b/kcleaner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python from __future__ import print_function import os import logging @@ -14,7 +14,7 @@ def ask_yn(yn_question, default='n'): tries = 0 while True: - response = input(f"{yn_question}(y/n)") + response = input("%s (y/n)" % (yn_question)) tries = tries + 1 if response in ['y', 'n']: break diff --git a/setup.py b/setup.py index cbd1ddf..f61c1b3 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='kcleaner', - version='0.3.1', + version='0.3.2', author='Gui Martins', url='https://fancywhale.ca/', author_email='gui.martins.94@outlook.com',