8000 Improve workflows (#88) · solarmonkey/setup-python@6cbb9cf · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6cbb9cf

Browse files
authored
Improve workflows (actions#88)
* Improve workflows * Update workflows * Small fix
1 parent 6c4e46d commit 6cbb9cf

File tree

4 files changed

+93
-13
lines changed

4 files changed

+93
-13
lines changed

.github/workflows/lint-yaml.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
name: Validate 'setup-python'
22
on:
33
push:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- '**.md'
48
pull_request:
9+
paths-ignore:
10+
- '**.md'
511
schedule:
612
- cron: 0 0 * * *
713

.github/workflows/workflow.yml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
name: Main workflow
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- '**.md'
8+
pull_request:
9+
paths-ignore:
10+
- '**.md'
311
jobs:
412
run:
513
name: Run
@@ -24,3 +32,59 @@ jobs:
2432

2533
- name: npm test
2634
run: npm test
35+
36+
- name: Run with setup-python 2.7
37+
uses: ./
38+
with:
39+
python-version: 2.7
40+
- name: Verify 2.7
41+
run: python __tests__/verify-python.py 2.7
42+
43+
- name: Run with setup-python 3.5
44+
uses: ./
45+
with:
46+
python-version: 3.5
47+
- name: Verify 3.5
48+
run: python __tests__/verify-python.py 3.5
49+
50+
- name: Run with setup-python 3.6
51+
uses: ./
52+
with:
53+
python-version: 3.6
54+
- name: Verify 3.6
55+
run: python __tests__/verify-python.py 3.6
56+
57+
- name: Run with setup-python 3.7
58+
uses: ./
59+
with:
60+
python-version: 3.7
61+
- name: Verify 3.7
62+
run: python __tests__/verify-python.py 3.7
63+
64+
- name: Run with setup-python 3.8
65+
uses: ./
66+
with:
67+
python-version: 3.8
68+
- name: Verify 3.8
69+
run: python __tests__/verify-python.py 3.8
70+
71+
- name: Run with setup-python 3.7.5
72+
uses: ./
73+
with:
74+
python-version: 3.7.5
75+
- name: Verify 3.7.5
76+
run: python __tests__/verify-python.py 3.7.5
77+
78+
- name: Run with setup-python 3.6.7
79+
uses: ./
80+
with:
81+
python-version: 3.6.7
82+
- name: Verify 3.6.7
83+
run: python __tests__/verify-python.py 3.6.7
84+
85+
- name: Run with setup-python 3.8.1
86+
uses: ./
87+
with:
88+
python-version: 3.8.1
89+
- name: Verify 3.8.1
90+
run: python __tests__/verify-python.py 3.8.1

__tests__/verify-python.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
argCount = len(sys.argv) - 1
3+
4+
if argCount == 1:
5+
expectedVersion = sys.argv[1]
6+
versions = len(expectedVersion.split("."))
7+
majorMinor = str(sys.version_info[0]) + '.' + str(sys.version_info[1])
8+
9+
if versions == 2:
10+
# Test only major and minor version
11+
if expectedVersion != majorMinor:
12+
raise Exception("Incorrect major + minor version detected\nExpected: " + expectedVersion + "\nActual: " + majorMinor)
13+
elif versions == 3:
14+
# Test major, minor and micro version
15+
majorMinorMicro = majorMinor + '.' + str(sys.version_info[2])
16+
if expectedVersion != majorMinorMicro:
17+
raise Exception("Incorrect major + minor + micro version detected\nExpected: " + expectedVersion + "\nActual: " + majorMinorMicro)
18+
else:
19+
raise Exception("Incorrect number of arguments supplied")
20+
print("Correct version of Python " + expectedVersion + " detected")
21+
else:
22+
raise Exception("Incorrect number of arguments supplied")

0 commit comments

Comments
 (0)
0