mirror of
https://github.com/actions/setup-python.git
synced 2024-11-25 02:16:54 +01:00
Improve workflows (#88)
* Improve workflows * Update workflows * Small fix
This commit is contained in:
parent
6c4e46d258
commit
6cbb9cfdfd
4 changed files with 93 additions and 13 deletions
12
.github/workflows/lint-yaml.yml
vendored
12
.github/workflows/lint-yaml.yml
vendored
|
@ -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
|
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
|
@ -1,7 +1,13 @@
|
|||
name: Validate 'setup-python'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
schedule:
|
||||
- cron: 0 0 * * *
|
||||
|
||||
|
|
66
.github/workflows/workflow.yml
vendored
66
.github/workflows/workflow.yml
vendored
|
@ -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.5
|
||||
uses: ./
|
||||
with:
|
||||
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.7
|
||||
uses: ./
|
||||
with:
|
||||
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: ./
|
||||
with:
|
||||
python-version: 3.8.1
|
||||
- name: Verify 3.8.1
|
||||
run: python __tests__/verify-python.py 3.8.1
|
||||
|
|
22
__tests__/verify-python.py
Normal file
22
__tests__/verify-python.py
Normal file
|
@ -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")
|
Loading…
Reference in a new issue