Skip to content

Commit da4d7fd

Browse files
committed
github: Add tests for setup-python and setup-poetry
1 parent 2c946e7 commit da4d7fd

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/test_actions.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,54 @@ on:
55
workflow_dispatch:
66

77
jobs:
8+
test_setup_python:
9+
name: Test setup-python
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [windows-latest, ubuntu-latest]
14+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
15+
steps:
16+
- name: Check out repo
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
- name: Set up Python
19+
uses: ./setup-python
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Check Python version
23+
run: |
24+
import sys
25+
version = sys.version_info[:2]
26+
expected_version = tuple("${{ matrix.python-version }}".split("."))
27+
if version != expected_version:
28+
print(f"::error title=Test Failure::The Python version does not match. Got {version}, expected {expected_version}.")
29+
sys.exit(1)
30+
shell: python
31+
test_setup_poetry:
32+
name: Test setup-poetry
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
matrix:
36+
os: [windows-latest, ubuntu-latest]
37+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
38+
steps:
39+
- name: Check out repo
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
- name: Set up Python
42+
uses: ./setup-python
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
- name: Set up Poetry
46+
uses: ./setup-poetry
47+
- name: Create project
48+
run: poetry new test-project
49+
- name: Check that the project was created
50+
run: |
51+
if [ ! -f test-project/pyproject.toml ]; then
52+
echo "::error title=Test Failure::The project file does not exist."
53+
exit 1
54+
fi
55+
shell: bash
856
test_check_project_version:
957
name: Test check-project-version
1058
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)