Skip to content

Commit e9141fa

Browse files
brenns10osandov
authored andcommitted
ci: reduce usage and add Python 3.12 beta
With 3.12 beta, there are 7 Python versions to test, which is making the test matrix too large. To reduce the amount of CI test runs that occur, by default we will only run 2: the oldest and newest released Python versions. To further reduce the CI test runs, we will eliminate CI runs when a branch is pushed (only main will be tested). The "ci" action becomes a reusable workflow, which gets called by other possible workflows: 1. pull_request.yml: On pull request, only the 2 default Python versions are tested. The "test-all-python-versions" label can be applied to pull requests to override this. 2. push.yml: On push to main, all Python versions are tested. 3. vmtest-build.yml: After the vmtest kernels are built 4. On manual request: the user has the option to specify Signed-off-by: Stephen Brennan <[email protected]>
1 parent cff9b61 commit e9141fa

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test_all_python_versions:
7+
description: "Run tests on all Python versions"
8+
type: boolean
9+
default: false
10+
required: true
11+
workflow_call:
12+
inputs:
13+
test_all_python_versions:
14+
description: "Run tests on all Python versions"
15+
type: boolean
16+
default: false
17+
required: true
418

519
concurrency:
620
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -13,7 +27,9 @@ jobs:
1327
runs-on: ubuntu-20.04
1428
strategy:
1529
matrix:
16-
python-version: ['3.11', '3.10', '3.9', '3.8', '3.7', '3.6']
30+
python-version: ${{ inputs.test_all_python_versions
31+
&& fromJSON('["3.12", "3.11", "3.10", "3.9", "3.8", "3.7", "3.6"]')
32+
|| fromJSON('["3.11", "3.6"]')}}
1733
cc: [gcc, clang]
1834
fail-fast: false
1935
env:
@@ -25,6 +41,7 @@ jobs:
2541
uses: actions/setup-python@v4
2642
with:
2743
python-version: ${{ matrix.python-version }}
44+
allow-prereleases: true
2845
- name: Install dependencies
2946
run: |
3047
sudo apt-get update

.github/workflows/pull_request.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Pull Request CI
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- labeled
10+
11+
jobs:
12+
test:
13+
uses: ./.github/workflows/ci.yml
14+
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'test-all-python-versions' }}
15+
with:
16+
test_all_python_versions: ${{ contains(github.event.pull_request.labels.*.name, 'test-all-python-versions') }}

.github/workflows/push.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Main Branch Push CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
uses: ./.github/workflows/ci.yml
11+
with:
12+
test_all_python_versions: true

.github/workflows/vmtest-build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ jobs:
3636
name: kernel-build-logs
3737
path: build/vmtest/kbuild/*.log
3838
if-no-files-found: ignore
39+
test:
40+
needs: build
41+
uses: ./.github/workflows/ci.yml
42+
with:
43+
test_all_python_versions: true

0 commit comments

Comments
 (0)