From 3bb7ea113e766ab207def2e1f06bc0e7d8bdbca7 Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Fri, 1 May 2020 15:38:19 +0200 Subject: [PATCH 1/3] Improve workflows --- .github/workflows/lint-yaml.yml | 12 ------ .github/workflows/workflow.yml | 66 ++++++++++++++++++++++++++++++++- __tests__/verify-python.py | 22 +++++++++++ 3 files changed, 87 insertions(+), 13 deletions(-) delete mode 100644 .github/workflows/lint-yaml.yml create mode 100644 __tests__/verify-python.py diff --git a/.github/workflows/lint-yaml.yml b/.github/workflows/lint-yaml.yml deleted file mode 100644 index 4511eed86..000000000 --- a/.github/workflows/lint-yaml.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Lint YAML -on: [pull_request] -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Lint action.yml - uses: ibiqlik/action-yamllint@master - with: - file_or_dir: action.yml - config_file: yaml-lint-config.yml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index fa0bb865e..dde6f4276 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,5 +1,13 @@ name: Main workflow -on: [push, pull_request] +on: + push: + branches: + - master + paths-ignore: + - '**.md' + pull_request: + paths-ignore: + - '**.md' jobs: run: name: Run @@ -24,3 +32,59 @@ jobs: - name: npm test run: npm test + + - name: Run with setup-python 2.7 + uses: ./ + with: + python-version: 2.7 + - name: Verify 2.7 + run: python __tests__/verify-python.py 2.7 + + - name: Run with setup-python 3.5 + uses: ./ + with: + python-version: 3.5 + - name: Verify 3.5 + run: python __tests__/verify-python.py 3.5 + + - name: Run with setup-python 3.6 + uses: ./ + with: + python-version: 3.6 + - name: Verify 3.6 + run: python __tests__/verify-python.py 3.6 + + - name: Run with setup-python 3.7 + uses: ./ + with: + python-version: 3.7 + - name: Verify 3.7 + run: python __tests__/verify-python.py 3.7 + + - name: Run with setup-python 3.8 + uses: ./ + with: + python-version: 3.8 + - name: Verify 3.8 + run: python __tests__/verify-python.py 3.8 + + - name: Run with setup-python 3.7.4 + uses: ./ + with: + python-version: 3.7.4 + - name: Verify 3.7.4 + run: python __tests__/verify-python.py 3.7.4 + + - name: Run with setup-python 3.6.2 + uses: ./ + with: + python-version: 3.6.2 + - name: Verify 3.6.2 + run: python __tests__/verify-python.py 3.6.2 + + - name: Run with setup-python 3.8.1 + uses: ./ + with: + python-version: 3.8.1 + - name: Verify 3.8.1 + run: python __tests__/verify-python.py 3.8.1 diff --git a/__tests__/verify-python.py b/__tests__/verify-python.py new file mode 100644 index 000000000..02a3604a1 --- /dev/null +++ b/__tests__/verify-python.py @@ -0,0 +1,22 @@ +import sys +argCount = len(sys.argv) - 1 + +if argCount == 1: + expectedVersion = sys.argv[1] + versions = len(expectedVersion.split(".")) + majorMinor = str(sys.version_info[0]) + '.' + str(sys.version_info[1]) + + if versions == 2: + # Test only major and minor version + if expectedVersion != majorMinor: + raise Exception("Incorrect major + minor version detected\nExpected: " + expectedVersion + "\nActual: " + majorMinor) + elif versions == 3: + # Test major, minor and micro version + majorMinorMicro = majorMinor + '.' + str(sys.version_info[2]) + if expectedVersion != majorMinorMicro: + raise Exception("Incorrect major + minor + micro version detected\nExpected: " + expectedVersion + "\nActual: " + majorMinorMicro) + else: + raise Exception("Incorrect number of arguments supplied") + print("Correct version of Python " + expectedVersion + " detected") +else: + raise Exception("Incorrect number of arguments supplied") \ No newline at end of file From a605d6b9301e95e2c26769f1cb263d4a0df32e6e Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Fri, 1 May 2020 15:45:32 +0200 Subject: [PATCH 2/3] Update workflows --- .github/workflows/test.yml | 5 +++++ .github/workflows/workflow.yml | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 456b99539..517c6f86f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,12 @@ name: Validate 'setup-python' on: push: + - master + paths-ignore: + - '**.md' pull_request: + paths-ignore: + - '**.md' schedule: - cron: 0 0 * * * diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index dde6f4276..2498319ee 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -68,19 +68,19 @@ jobs: - name: Verify 3.8 run: python __tests__/verify-python.py 3.8 - - name: Run with setup-python 3.7.4 + - name: Run with setup-python 3.7.5 uses: ./ with: - python-version: 3.7.4 - - name: Verify 3.7.4 - run: python __tests__/verify-python.py 3.7.4 + python-version: 3.7.5 + - name: Verify 3.7.5 + run: python __tests__/verify-python.py 3.7.5 - - name: Run with setup-python 3.6.2 + - name: Run with setup-python 3.6.7 uses: ./ with: - python-version: 3.6.2 - - name: Verify 3.6.2 - run: python __tests__/verify-python.py 3.6.2 + python-version: 3.6.7 + - name: Verify 3.6.7 + run: python __tests__/verify-python.py 3.6.7 - name: Run with setup-python 3.8.1 uses: ./ From 7fbd4a4cbc41e3b307f8cae704f8f3735fbc9d07 Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Fri, 1 May 2020 16:35:22 +0200 Subject: [PATCH 3/3] Small fix --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 517c6f86f..82c5e5fd8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,8 @@ name: Validate 'setup-python' on: push: - - master + branches: + - master paths-ignore: - '**.md' pull_request: