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 3d8ac1d

Browse filesBrowse files
authored
Update README.md
1 parent 2268531 commit 3d8ac1d
Copy full SHA for 3d8ac1d

File tree

Expand file treeCollapse file tree

1 file changed

+48
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+48
-1
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+48-1Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Matrix Testing:
2828
```yaml
2929
jobs:
3030
build:
31-
runs-on: ubuntu-16.04
31+
runs-on: ubuntu-latest
3232
strategy:
3333
matrix:
3434
python-version: [ '2.x', '3.x', 'pypy2', 'pypy3' ]
@@ -42,6 +42,53 @@ jobs:
4242
architecture: x64
4343
- run: python my_script.py
4444
```
45+
46+
Exclude a specific Python version:
47+
```yaml
48+
jobs:
49+
build:
50+
runs-on: ubuntu-latest
51+
strategy:
52+
matrix:
53+
os: [ubuntu-latest, macos-latest, windows-latest]
54+
python-version: [2.7, 3.6, 3.7, 3.8, pypy2, pypy3]
55+
exclude:
56+
- os: macos-latest
57+
python-version: 3.8
58+
- os: windows-latest
59+
python-version: 3.6
60+
steps:
61+
- uses: actions/checkout@v1
62+
- name: Set up Python
63+
uses: actions/setup-python@v1
64+
with:
65+
python-version: ${{ matrix.python-version }}
66+
- name: Display Python version
67+
run: python -c "import sys; print(sys.version)"
68+
```
69+
70+
# Getting started with Python + Actions
71+
72+
Check out our detailed guide on using [Python with GitHub Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-python-with-github-actions).
73+
74+
# Hosted Tool Cache
75+
76+
GitHub hosted runners have a tools cache that comes with Python + PyPy already installed. This tools cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and there is where you will find Python and PyPy installed. `setup-python` works by taking a specific version of Python or PyPy in this tools cache and adding it to PATH.
77+
78+
|| Location |
79+
|------|-------|
80+
|**Tool Cache Directory** |`RUNNER_TOOL_CACHE`|
81+
|**Python Tool Cache**|`RUNNER_TOOL_CACHE/Python/*`|
82+
|**PyPy Tool Cache**|`RUNNER_TOOL_CACHE/PyPy/*`|
83+
84+
GitHub virtual environments are setup in [actions/virtual-environments](https://github.com/actions/virtual-environments). During the setup, the available versions of Python and PyPy are automatically downloaded, setup and documented.
85+
- [Tools cache setup for Ubuntu](https://github.com/actions/virtual-environments/blob/master/images/linux/scripts/installers/1804/hosted-tool-cache.sh)
86+
- [Tools cache setup for Windows](https://github.com/actions/virtual-environments/blob/master/images/win/scripts/Installers/Download-ToolCache.ps1)
87+
88+
# Using Python without `setup-python`
89+
90+
`setup-python` helps keep your dependencies explicit and ensures consistent behavior between different runners. If you use `python` in a shell on a GitHub hosted runner without `setup-python` it will default to whatever is in PATH. The default version of Python in PATH vary between runners and can change unexpectedly so we recommend you always use `setup-python`.
91+
4592
# Available versions of Python
4693

4794
For detailed information regarding the available versions of Python that are installed see [Software installed on GitHub-hosted runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.