-
Notifications
You must be signed in to change notification settings - Fork 17
49 lines (43 loc) · 1.39 KB
/
python-version-check.yml
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
name: python version check
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
manual:
description: "Trigger the workflow manually"
required: false
jobs:
test:
name: python version check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get current required Python version
id: get-python-versions
run: |
MINIMUM_VERSION=$(grep -oP '__version_minimum_python__ = "\K.*(?=")' leeger/_version.py)
echo "CURRENT_VERSION=$MINIMUM_VERSION" >> $GITHUB_ENV
OLD_VERSION="${MINIMUM_VERSION%.*}.$((${MINIMUM_VERSION##*.}-1))"
echo "OLD_VERSION=$OLD_VERSION" >> $GITHUB_ENV
- name: Set up current Python version
uses: actions/setup-python@v3
with:
python-version: ${{ env.CURRENT_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: setup.py with current required Python version works
run: |
python setup.py install
- name: Set up invalid Python version
uses: actions/setup-python@v3
with:
python-version: ${{ env.OLD_VERSION }}
- name: setup.py with invalid Python version fails
run: |
! python setup.py install