Repository navigation
56 lines (56 loc) · 2.14 KB
/
Copy path__test-action-setup-python.yml
File metadata and controls
56 lines (56 loc) · 2.14 KB
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
---
name: Internal - Test setup-python action
"on":
workflow_call: null
permissions: {}
jobs:
setup-python:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- name: Arrange - Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Assert - Action contract tests pass
uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0
with:
command: test:ci
arguments: '["actions/setup-python/action.test.cjs"]'
coverage: ""
comment: "false"
- name: Act - Detect the runtime and install dependencies
uses: $/actions/setup-python
with:
working-directory: tests/python-project
id: setup
- name: Assert - Locked development environment is installed
shell: bash
run: |
test "$(uv self version --short)" = "$UV_VERSION"
test -x tests/python-project/.venv/bin/python
tests/python-project/.venv/bin/python -c 'import pytest, ci_python_fixture'
git diff --exit-code -- tests/python-project/pyproject.toml tests/python-project/uv.lock
env:
UV_VERSION: ${{ steps.setup.outputs.uv-version }}
- name: Arrange - Project without a lock or environment
shell: bash
run: |
mkdir .test-python-runtime
cp tests/python-project/pyproject.toml tests/python-project/.python-version .test-python-runtime/
- name: Act - Select a runtime without dependencies
uses: $/actions/setup-python
with:
working-directory: .test-python-runtime
python-version: "3.13"
install-dependencies: "false"
- name: Assert - Explicit version wins without synchronizing
shell: bash
run: |
python_path=$(uv python find --managed-python "$UV_PYTHON")
"$python_path" -c 'import sys; assert sys.version_info[:2] == (3, 13)'
test ! -d .venv
test ! -f uv.lock
working-directory: .test-python-runtime