FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/.github/workflows/reusable-context.yml at main · python/cpython · GitHub
python
cpython
Repository navigation
Code
Issues
5k+
(5k+)
Pull requests
2.4k
(2.4k)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
.github
/
workflows
/
reusable-context.yml
Copy path
View runs
More file actions
More file actions
Latest commit
History
History
History
125 lines (115 loc) · 5.35 KB
Breadcrumbs
cpython
/
.github
/
workflows
/
reusable-context.yml
Copy path
File metadata and controls
125 lines (115 loc) · 5.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name
:
Reusable build context
on
:
#
yamllint disable-line rule:truthy
workflow_call
:
outputs
:
#
Every referenced step MUST always set its output variable,
#
either via ``Tools/build/compute-changes.py`` or in this workflow file.
#
Boolean outputs (generally prefixed ``run-``) can then later be used
#
safely through the following idiom in job conditionals and other
#
expressions. Here's some examples:
#
#
if: fromJSON(needs.build-context.outputs.run-tests)
#
#
${{
#
fromJSON(needs.build-context.outputs.run-tests)
#
&& 'truthy-branch'
#
|| 'falsy-branch'
#
}}
#
run-android
:
description
:
Whether to run the Android tests
value
:
${{ jobs.compute-changes.outputs.run-android }}
#
bool
run-ci-fuzz
:
description
:
Whether to run the CIFuzz job for 'cpython' fuzzer
value
:
${{ jobs.compute-changes.outputs.run-ci-fuzz }}
#
bool
run-ci-fuzz-stdlib
:
description
:
Whether to run the CIFuzz job for 'python3-libraries' fuzzer
value
:
${{ jobs.compute-changes.outputs.run-ci-fuzz-stdlib }}
#
bool
run-docs
:
description
:
Whether to build the docs
value
:
${{ jobs.compute-changes.outputs.run-docs }}
#
bool
run-ios
:
description
:
Whether to run the iOS tests
value
:
${{ jobs.compute-changes.outputs.run-ios }}
#
bool
run-macos
:
description
:
Whether to run the macOS tests
value
:
${{ jobs.compute-changes.outputs.run-macos }}
#
bool
run-tests
:
description
:
Whether to run the regular tests
value
:
${{ jobs.compute-changes.outputs.run-tests }}
#
bool
run-ubuntu
:
description
:
Whether to run the Ubuntu tests
value
:
${{ jobs.compute-changes.outputs.run-ubuntu }}
#
bool
run-emscripten
:
description
:
Whether to run the Emscripten tests
value
:
${{ jobs.compute-changes.outputs.run-emscripten }}
#
bool
run-wasi
:
description
:
Whether to run the WASI tests
value
:
${{ jobs.compute-changes.outputs.run-wasi }}
#
bool
run-windows-tests
:
description
:
Whether to run the Windows tests
value
:
${{ jobs.compute-changes.outputs.run-windows-tests }}
#
bool
permissions
:
contents
:
read
jobs
:
compute-changes
:
name
:
Create context from changed files
runs-on
:
ubuntu-latest
timeout-minutes
:
10
outputs
:
run-android
:
${{ steps.changes.outputs.run-android }}
run-ci-fuzz
:
${{ steps.changes.outputs.run-ci-fuzz }}
run-ci-fuzz-stdlib
:
${{ steps.changes.outputs.run-ci-fuzz-stdlib }}
run-docs
:
${{ steps.changes.outputs.run-docs }}
run-ios
:
${{ steps.changes.outputs.run-ios }}
run-macos
:
${{ steps.changes.outputs.run-macos }}
run-tests
:
${{ steps.changes.outputs.run-tests }}
run-ubuntu
:
${{ steps.changes.outputs.run-ubuntu }}
run-emscripten
:
${{ steps.changes.outputs.run-emscripten }}
run-wasi
:
${{ steps.changes.outputs.run-wasi }}
run-windows-tests
:
${{ steps.changes.outputs.run-windows-tests }}
steps
:
-
name
:
Set up Python
uses
:
actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
#
v7.0.0
with
:
python-version
:
"
3
"
-
run
:
>-
echo '${{ github.event_name }}'
-
uses
:
actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
#
v7.0.1
with
:
persist-credentials
:
false
ref
:
>-
${{
github.event_name == 'pull_request'
&& github.event.pull_request.head.sha
|| ''
}}
#
Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
-
name
:
Fetch commits to get branch diff
if
:
github.event_name == 'pull_request'
run
:
|
set -eux
# Fetch enough history to find a common ancestor commit (aka merge-base):
git fetch origin "${refspec_pr}" --depth=$(( commits + 1 )) \
--no-tags --prune --no-recurse-submodules
# This should get the oldest commit in the local fetched history (which may not be the commit the PR branched from):
COMMON_ANCESTOR=$( git rev-list --first-parent --max-parents=0 --max-count=1 "${branch_pr}" )
DATE=$( git log --date=iso8601 --format=%cd "${COMMON_ANCESTOR}" )
# Get all commits since that commit date from the base branch (eg: main):
git fetch origin "${refspec_base}" --shallow-since="${DATE}" \
--no-tags --prune --no-recurse-submodules
env
:
branch_pr
:
'
origin/${{ github.event.pull_request.head.ref }}
'
commits
:
${{ github.event.pull_request.commits }}
refspec_base
:
'
+${{ github.event.pull_request.base.sha }}:remotes/origin/${{ github.event.pull_request.base.ref }}
'
refspec_pr
:
'
+${{ github.event.pull_request.head.sha }}:remotes/origin/${{ github.event.pull_request.head.ref }}
'
#
We only want to run tests on PRs when related files are changed,
#
or when someone triggers a manual workflow run.
-
name
:
Compute changed files
id
:
changes
run
:
python Tools/build/compute-changes.py
env
:
GITHUB_DEFAULT_BRANCH
:
${{ github.event.repository.default_branch }}
GITHUB_EVENT_NAME
:
${{ github.event_name }}
CCF_TARGET_REF
:
${{ github.base_ref || github.event.repository.default_branch }}
CCF_HEAD_REF
:
${{ github.event.pull_request.head.sha || github.sha }}
Back
|
FazBrowse Home
|
New Git URL