-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (86 loc) · 3.26 KB
/
python-tests.yml
File metadata and controls
99 lines (86 loc) · 3.26 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
96
97
98
99
# This workflow will install Python dependencies, run tests and lint with multiple Python versions.
# For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python tests
on:
workflow_dispatch:
push:
branches: ['main']
pull_request:
types: [ready_for_review, review_requested]
issue_comment:
types: [created]
# There is duplication in the build and build_pr_comment jobs, but avoiding that will need
# quite a bit of work for reusable workflow or a composite action which is not worth it.
# Note that rootless podman is available by default in ubuntu-22.04/24.04 github runner
# images (https://github.com/actions/runner-images/tree/main/images/ubuntu), so the jobs
# below run just fine even without the "ScribeMD/rootless-docker@0.2.2" image, but it
# is present to enable testing with rootless docker too which the current tox.ini
# configures for some python versions randomly.
jobs:
build:
if: ${{ github.event_name != 'issue_comment' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
os: [ubuntu-22.04]
steps:
- name: Use Docker in rootless mode
uses: ScribeMD/rootless-docker@0.2.2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade tox-gh>=1.3
- name: Run tox actions
run: tox -- -s --verbose
build_pr_comment:
if: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == '/test' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
os: [ubuntu-22.04]
steps:
- name: Use Docker in rootless mode
uses: ScribeMD/rootless-docker@0.2.2
- uses: actions/checkout@v4
- name: Checkout branch for PR and output SHA
id: 'get-sha'
run: |
gh pr checkout $PR_NO --repo $REPO
echo "sha=$(gh pr view $PR_NO --repo $REPO --json headRefOid --jq '.headRefOid')" >> $GITHUB_OUTPUT
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set status as pending
uses: myrotvorets/set-commit-status-action@master
with:
sha: ${{ steps.get-sha.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade tox-gh>=1.3
- name: Run tox actions
run: tox -- -s --verbose
- name: Set status as ${{ job.status }}
if: always()
uses: myrotvorets/set-commit-status-action@master
with:
sha: ${{ steps.get-sha.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}