Repository navigation
95 lines (86 loc) · 3 KB
/
Copy pathtest-python-environment.yml
File metadata and controls
95 lines (86 loc) · 3 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
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
# This workflow verifies if the python-environment Action is successful on each
# of the selected GitHub Runners.
name: Test python-environment Action
on:
workflow_call:
jobs:
check-changes:
runs-on: "ubuntu-24.04"
outputs:
should_run: ${{ steps.diff.outputs.should_run }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- id: diff
env:
BASE_REF: ${{ github.base_ref || 'main' }}
run: |
# Always run if the current branch is main
if [ "${GITHUB_REF_NAME}" == "main" ]; then
echo "Branch is main, forcing run."
echo "should_run=true" >> $GITHUB_OUTPUT
# Otherwise, check if any relevant files were changed in this PR
else
if git diff --quiet "origin/$BASE_REF...HEAD" -- .github/actions/python-environment .github/workflows/test-python-environment.yml; then
echo "No changes in .github/actions/python-environment or .github/workflows/test-python-environment.yml, skipping."
echo "should_run=false" >> $GITHUB_OUTPUT
else
echo "Changes detected in directory, running."
echo "should_run=true" >> $GITHUB_OUTPUT
fi
fi
build-matrix:
name: Build Matrix
needs:
- check-changes
if: needs.check-changes.outputs.should_run == 'true'
uses: $/.github/workflows/matrix.yml
with:
matrix_keys_json: '["python_versions"]'
permissions:
contents: read
verify-poetry-setup:
needs:
- check-changes
- build-matrix
if: needs.check-changes.outputs.should_run == 'true'
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-24.04-arm
- int-linux-x64-4core-gpu-t4-ubuntu24.04-1
- int-linux-x64-4core-ubuntu24.04-1
- int-linux-x64-2core-ubuntu24.04-1
python-versions: ${{ fromJson(needs.build-matrix.outputs.matrix).python_versions }}
name: Verify Poetry Setup for ${{ matrix.runner }} (Python-${{ matrix.python-versions }})
runs-on:
labels: ${{ matrix.runner }}
steps:
- name: Check out Repository
id: check-out-repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up Python & Poetry Environment
id: set-up-python-and-poetry-environment
uses: $/.github/actions/python-environment
with:
python-version: "${{ matrix.python-versions }}"
poetry-version: "2.3.0"
- name: Check Poetry Version
id: check-poetry-version
run: poetry --version
- name: Validate Python Version
id: validate-python-version
env:
PYTHON_VERSION: ${{ matrix.python-versions }}
run: |
poetry run which python
poetry run python --version
poetry env list
poetry run python --version | grep "$PYTHON_VERSION"