[3.8] bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (G… · python/cpython@07bd5cf (original) (raw)

1

1

`name: Tests

`

2

2

``

``

3

`+

bpo-40548: "paths-ignore" is not used to skip documentation-only PRs, because

`

``

4

`+

it prevents to mark a job as mandatory. A PR cannot be merged if a job is

`

``

5

`+

mandatory but not scheduled because of "paths-ignore".

`

3

6

`on:

`

4

``

`-

#push:

`

5

``

`-

branches:

`

6

``

`-

- master

`

7

``

`-

- 3.8

`

8

``

`-

- 3.7

`

9

``

`-

paths-ignore:

`

10

``

`-

- 'Doc/**'

`

11

``

`-

- 'Misc/**'

`

12

7

`pull_request:

`

13

8

`branches:

`

14

9

` - master

`

15

10

` - 3.8

`

16

11

` - 3.7

`

17

``

`-

paths-ignore:

`

18

``

`-

`

19

``

`-

`

20

12

``

21

13

`jobs:

`

``

14

`+

check_source:

`

``

15

`+

name: 'Check for source changes'

`

``

16

`+

runs-on: ubuntu-latest

`

``

17

`+

outputs:

`

``

18

`+

run_tests: ${{ steps.check.outputs.run_tests }}

`

``

19

`+

steps:

`

``

20

`+

`

``

21

`+

`

``

22

`+

id: check

`

``

23

`+

run: |

`

``

24

`+

if [ -z "GITHUB_BASE_REF" ]; then

`

``

25

`+

echo '::set-output name=run_tests::true'

`

``

26

`+

else

`

``

27

`+

git fetch origin $GITHUB_BASE_REF --depth=1

`

``

28

`+

git diff --name-only origin/$GITHUB_BASE_REF... | grep -qvE '(.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true

`

``

29

`+

fi

`

22

30

`build_win32:

`

23

31

`name: 'Windows (x86)'

`

24

32

`runs-on: windows-latest

`

``

33

`+

needs: check_source

`

``

34

`+

if: needs.check_source.outputs.run_tests == 'true'

`

25

35

`steps:

`

26

36

` - uses: actions/checkout@v1

`

27

37

` - name: Build CPython

`

`@@ -34,6 +44,8 @@ jobs:

`

34

44

`build_win_amd64:

`

35

45

`name: 'Windows (x64)'

`

36

46

`runs-on: windows-latest

`

``

47

`+

needs: check_source

`

``

48

`+

if: needs.check_source.outputs.run_tests == 'true'

`

37

49

`steps:

`

38

50

` - uses: actions/checkout@v1

`

39

51

` - name: Build CPython

`

`@@ -46,6 +58,8 @@ jobs:

`

46

58

`build_macos:

`

47

59

`name: 'macOS'

`

48

60

`runs-on: macos-latest

`

``

61

`+

needs: check_source

`

``

62

`+

if: needs.check_source.outputs.run_tests == 'true'

`

49

63

`steps:

`

50

64

` - uses: actions/checkout@v1

`

51

65

` - name: Configure CPython

`

`@@ -60,6 +74,8 @@ jobs:

`

60

74

`build_ubuntu:

`

61

75

`name: 'Ubuntu'

`

62

76

`runs-on: ubuntu-latest

`

``

77

`+

needs: check_source

`

``

78

`+

if: needs.check_source.outputs.run_tests == 'true'

`

63

79

`env:

`

64

80

`OPENSSL_VER: 1.1.1f

`

65

81

`steps:

`