Split CI matrix run over several runners
This commit is contained in:
parent
cc497fb62b
commit
fe97f8f0f0
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@ -138,6 +138,11 @@ jobs:
|
|||||||
|
|
||||||
unittest-linux:
|
unittest-linux:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
compiler: [g++-10, clang++-18]
|
||||||
|
dwarf_version: [4, 5]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: dependencies
|
- name: dependencies
|
||||||
@ -147,7 +152,7 @@ jobs:
|
|||||||
cpptrace/ci/setup-prerequisites-unittest.sh
|
cpptrace/ci/setup-prerequisites-unittest.sh
|
||||||
- name: build and test
|
- name: build and test
|
||||||
run: |
|
run: |
|
||||||
python3 ci/unittest.py
|
python3 ci/unittest.py --slice=compiler:${{matrix.compiler}} --slice=dwarf_version:${{matrix.dwarf_version}}
|
||||||
unittest-linux-bazel:
|
unittest-linux-bazel:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
24
ci/util.py
24
ci/util.py
@ -1,7 +1,7 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import itertools
|
import itertools
|
||||||
from typing import List
|
from typing import List, Dict
|
||||||
from colorama import Fore, Back, Style
|
from colorama import Fore, Back, Style
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
@ -23,6 +23,7 @@ class MatrixRunner:
|
|||||||
def __init__(self, matrix, exclude):
|
def __init__(self, matrix, exclude):
|
||||||
self.matrix = matrix
|
self.matrix = matrix
|
||||||
self.exclude = exclude
|
self.exclude = exclude
|
||||||
|
self.include = self.parse_includes()
|
||||||
self.keys = [*matrix.keys()]
|
self.keys = [*matrix.keys()]
|
||||||
self.values = [*matrix.values()]
|
self.values = [*matrix.values()]
|
||||||
self.results = {} # insertion-ordered
|
self.results = {} # insertion-ordered
|
||||||
@ -32,6 +33,17 @@ class MatrixRunner:
|
|||||||
self.last_matrix_config = None
|
self.last_matrix_config = None
|
||||||
self.current_matrix_config = None
|
self.current_matrix_config = None
|
||||||
|
|
||||||
|
def parse_includes(self) -> Dict[str, List[str]]:
|
||||||
|
includes: Dict[str, List[str]] = dict()
|
||||||
|
for arg in sys.argv:
|
||||||
|
if arg.startswith("--slice="):
|
||||||
|
rest = arg[len("--slice="):]
|
||||||
|
key, value = rest.split(":")
|
||||||
|
if key not in includes:
|
||||||
|
includes[key] = []
|
||||||
|
includes[key].append(value)
|
||||||
|
return includes
|
||||||
|
|
||||||
def run_command(self, *args: List[str], always_output=False, output_matcher=None) -> bool:
|
def run_command(self, *args: List[str], always_output=False, output_matcher=None) -> bool:
|
||||||
self.log(f"{Fore.CYAN}{Style.BRIGHT}Running Command \"{' '.join(args)}\"{Style.RESET_ALL}")
|
self.log(f"{Fore.CYAN}{Style.BRIGHT}Running Command \"{' '.join(args)}\"{Style.RESET_ALL}")
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
@ -78,6 +90,11 @@ class MatrixRunner:
|
|||||||
def do_exclude(self, matrix_config, exclude):
|
def do_exclude(self, matrix_config, exclude):
|
||||||
return all(map(lambda k: matrix_config[k] == exclude[k], exclude.keys()))
|
return all(map(lambda k: matrix_config[k] == exclude[k], exclude.keys()))
|
||||||
|
|
||||||
|
def do_include(self, matrix_config, include):
|
||||||
|
if len(include) == 0:
|
||||||
|
return True
|
||||||
|
return all(map(lambda k: matrix_config[k] in include[k], include.keys()))
|
||||||
|
|
||||||
def assignment_to_matrix_config(self, assignment):
|
def assignment_to_matrix_config(self, assignment):
|
||||||
matrix_config = {}
|
matrix_config = {}
|
||||||
for k, v in zip(self.matrix.keys(), assignment):
|
for k, v in zip(self.matrix.keys(), assignment):
|
||||||
@ -87,7 +104,10 @@ class MatrixRunner:
|
|||||||
def get_work(self):
|
def get_work(self):
|
||||||
work = []
|
work = []
|
||||||
for assignment in itertools.product(*self.matrix.values()):
|
for assignment in itertools.product(*self.matrix.values()):
|
||||||
if any(map(lambda ex: self.do_exclude(self.assignment_to_matrix_config(assignment), ex), self.exclude)):
|
config = self.assignment_to_matrix_config(assignment)
|
||||||
|
if any(map(lambda ex: self.do_exclude(config, ex), self.exclude)):
|
||||||
|
continue
|
||||||
|
if not self.do_include(config, self.include):
|
||||||
continue
|
continue
|
||||||
work.append(assignment)
|
work.append(assignment)
|
||||||
return work
|
return work
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user