add support for python-version-file (#336) · actions/setup-python@53e1529 (original) (raw)

`@@ -10,35 +10,46 @@ on:

`

10

10

` - '**.md'

`

11

11

`schedule:

`

12

12

` - cron: 30 3 * * *

`

``

13

`+

workflow_dispatch:

`

13

14

``

14

15

`jobs:

`

15

``

`-

default-version:

`

16

``

`-

name: Setup default version

`

``

16

`+

setup-versions-from-manifest:

`

``

17

`+

name: Setup matrix.python{{ matrix.python }} matrix.python{{ matrix.os }}

`

17

18

`runs-on: ${{ matrix.os }}

`

18

19

`strategy:

`

19

20

`fail-fast: false

`

20

21

`matrix:

`

21

22

`os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]

`

``

23

`+

python: [3.5.4, 3.6.7, 3.7.5, 3.8.1]

`

22

24

`steps:

`

23

25

` - name: Checkout

`

24

``

`-

uses: actions/checkout@v2

`

``

26

`+

uses: actions/checkout@v3

`

25

27

``

26

``

`-

`

``

28

`+

`

27

29

`id: setup-python

`

28

30

`uses: ./

`

``

31

`+

with:

`

``

32

`+

python-version: ${{ matrix.python }}

`

29

33

``

30

34

` - name: Check python-path

`

31

35

`run: ./tests/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'

`

32

36

`shell: bash

`

33

37

``

34

38

` - name: Validate version

`

35

``

`-

run: python --version

`

``

39

`+

run: |

`

``

40

`+

$pythonVersion = (python --version)

`

``

41

`+

if ("Python matrix.python"−ne"{{ matrix.python }}" -ne "matrix.python"ne"pythonVersion"){

`

``

42

`+

Write-Host "The current version is pythonVersion;expectedversionispythonVersion; expected version is pythonVersion;expectedversionis{{ matrix.python }}"

`

``

43

`+

exit 1

`

``

44

`+

}

`

``

45

`+

$pythonVersion

`

``

46

`+

shell: pwsh

`

36

47

``

37

``

`-

`

``

48

`+

`

38

49

`run: python -c 'import math; print(math.factorial(5))'

`

39

50

``

40

``

`-

setup-versions-from-manifest:

`

41

``

`-

name: Setup matrix.python{{ matrix.python }} matrix.python{{ matrix.os }}

`

``

51

`+

setup-versions-from-file:

`

``

52

`+

name: Setup matrix.python{{ matrix.python }} matrix.python{{ matrix.os }} version file

`

42

53

`runs-on: ${{ matrix.os }}

`

43

54

`strategy:

`

44

55

`fail-fast: false

`

`@@ -47,13 +58,16 @@ jobs:

`

47

58

`python: [3.5.4, 3.6.7, 3.7.5, 3.8.1]

`

48

59

`steps:

`

49

60

` - name: Checkout

`

50

``

`-

uses: actions/checkout@v2

`

``

61

`+

uses: actions/checkout@v3

`

``

62

+

``

63

`+

`

``

64

`+

run: echo ${{ matrix.python }} > .python-version

`

51

65

``

52

66

` - name: setup-python ${{ matrix.python }}

`

53

67

`id: setup-python

`

54

68

`uses: ./

`

55

69

`with:

`

56

``

`-

python-version: ${{ matrix.python }}

`

``

70

`+

python-version-file: '.python-version'

`

57

71

``

58

72

` - name: Check python-path

`

59

73

`run: ./tests/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'

`

81

95

`os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]

`

82

96

`steps:

`

83

97

` - name: Checkout

`

84

``

`-

uses: actions/checkout@v2

`

``

98

`+

uses: actions/checkout@v3

`

85

99

``

86

100

` - name: setup-python 3.9.0-beta.4

`

87

101

`id: setup-python

`