Skip to content

Commit 161c3a6

Browse files
author
IvanZosimov
committed
Merge branch 'main' into CacheLibVersionUpdate
2 parents c61bc3d + ab6deb3 commit 161c3a6

20 files changed

+2223
-1059
lines changed

.github/workflows/e2e-cache.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ jobs:
4848
python-version: ${{ matrix.python-version }}
4949
cache: 'pipenv'
5050
- name: Install pipenv
51-
run: pipx install pipenv
51+
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
5252
- name: Install dependencies
5353
run: |
54-
cd __tests__/data
55-
pipenv install --verbose
54+
mv ./__tests__/data/Pipfile.lock .
55+
mv ./__tests__/data/Pipfile .
56+
pipenv install --keep-outdated
5657
5758
python-poetry-dependencies-caching:
5859
name: Test poetry (Python ${{ matrix.python-version}}, ${{ matrix.os }})
@@ -112,8 +113,9 @@ jobs:
112113
cache: 'pipenv'
113114
cache-dependency-path: '**/pipenv-requirements.txt'
114115
- name: Install pipenv
115-
run: pipx install pipenv
116+
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
116117
- name: Install dependencies
117118
run: |
118-
cd __tests__/data
119-
pipenv install --verbose
119+
mv ./__tests__/data/Pipfile.lock .
120+
mv ./__tests__/data/Pipfile .
121+
pipenv install --keep-outdated

.github/workflows/test-pypy.yml

+26
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,29 @@ jobs:
6565
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
6666
${EXECUTABLE} --version
6767
shell: bash
68+
69+
setup-pypy-noenv:
70+
name: Setup PyPy ${{ matrix.pypy }} ${{ matrix.os }} (noenv)
71+
runs-on: ${{ matrix.os }}
72+
strategy:
73+
fail-fast: false
74+
matrix:
75+
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-latest]
76+
pypy: ['pypy2.7', 'pypy3.7', 'pypy3.8', 'pypy3.9-nightly']
77+
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v3
81+
82+
- name: setup-python ${{ matrix.pypy }}
83+
id: setup-python
84+
uses: ./
85+
with:
86+
python-version: ${{ matrix.pypy }}
87+
update-environment: false
88+
89+
- name: PyPy and Python version
90+
run: ${{ steps.setup-python.outputs.python-path }} --version
91+
92+
- name: Run simple code
93+
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'

.github/workflows/test-python.yml

+25
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,28 @@ jobs:
147147

148148
- name: Run simple code
149149
run: python -c 'import math; print(math.factorial(5))'
150+
151+
setup-versions-noenv:
152+
name: Setup ${{ matrix.python }} ${{ matrix.os }} (noenv)
153+
runs-on: ${{ matrix.os }}
154+
strategy:
155+
fail-fast: false
156+
matrix:
157+
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
158+
python: ["3.7", "3.8", "3.9", "3.10"]
159+
steps:
160+
- name: Checkout
161+
uses: actions/checkout@v3
162+
163+
- name: setup-python ${{ matrix.python }}
164+
id: setup-python
165+
uses: ./
166+
with:
167+
python-version: ${{ matrix.python }}
168+
update-environment: false
169+
170+
- name: Python version
171+
run: ${{ steps.setup-python.outputs.python-path }} --version
172+
173+
- name: Run simple code
174+
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'

.licenses/npm/@actions/core.dep.yml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.licenses/npm/@actions/http-client-1.0.8.dep.yml

-32
This file was deleted.

README.md

+24-4
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ steps:
269269
```yaml
270270
steps:
271271
- uses: actions/checkout@v3
272-
- name: Install pipenv
273-
run: pipx install pipenv
274272
- uses: actions/setup-python@v4
275273
with:
276274
python-version: '3.9'
277275
cache: 'pipenv'
276+
- name: Install pipenv
277+
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
278278
- run: pipenv install
279279
```
280280
@@ -308,18 +308,38 @@ steps:
308308
```yaml
309309
steps:
310310
- uses: actions/checkout@v3
311-
- name: Install pipenv
312-
run: pipx install pipenv
313311
- uses: actions/setup-python@v4
314312
with:
315313
python-version: '3.9'
316314
cache: 'pipenv'
317315
cache-dependency-path: |
318316
server/app/Pipfile.lock
319317
__test__/app/Pipfile.lock
318+
- name: Install pipenv
319+
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
320320
- run: pipenv install
321321
```
322322
323+
# Environment variables
324+
325+
The `update-environment` flag defaults to `true`.
326+
With this setting, the action will add/update environment variables (e.g. `PATH`, `PKG_CONFIG_PATH`, `pythonLocation`) for `python` to just work out of the box.
327+
328+
If `update-environment` is set to `false`, the action will not add/update environment variables.
329+
This can prove useful if you want the only side-effect to be to ensure python is installed and rely on the `python-path` output to run python.
330+
Such a requirement on side-effect could be because you don't want your composite action messing with your user's workflows.
331+
332+
```yaml
333+
steps:
334+
- uses: actions/checkout@v3
335+
- uses: actions/setup-python@v4
336+
id: cp310
337+
with:
338+
python-version: '3.10'
339+
update-environment: false
340+
- run: ${{ steps.cp310.outputs.python-path }} my_script.py
341+
```
342+
323343
# Using `setup-python` with a self hosted runner
324344

325345
Python distributions are only available for the same [environments](https://github.com/actions/virtual-environments#available-environments) that GitHub Actions hosted environments are available for. If you are using an unsupported version of Ubuntu such as `19.04` or another Linux distribution such as Fedora, `setup-python` will not work. If you have a supported self-hosted runner and you would like to use `setup-python`, there are a few extra things you need to make sure are set up so that new versions of Python can be downloaded and configured on your runner.

__tests__/cache-restore.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {getCacheDistributor} from '../src/cache-distributions/cache-factory';
55

66
describe('restore-cache', () => {
77
const pipFileLockHash =
8-
'd1dd6218299d8a6db5fc2001d988b34a8b31f1e9d0bb4534d377dde7c19f64b3';
8+
'a3bdcc71289e4979ca9e051810d81999cc99823109faf6912e17ff14c8e621a6';
99
const requirementsHash =
1010
'd8110e0006d7fb5ee76365d565eef9d37df1d11598b912d3eb66d398d57a1121';
1111
const requirementsLinuxHash =

__tests__/data/Pipfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
numpy = "1.22.3"
8-
pandas = "1.4.2"
7+
flake8 = "==4.0.1"
8+
numpy = "==1.23.0"
99

1010
[dev-packages]
1111

__tests__/data/Pipfile.lock

+44-61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)