Stratify test ci

This commit is contained in:
Jeremy 2024-02-27 20:06:34 -06:00
parent 76aff1c30e
commit c6a60f7172
No known key found for this signature in database
GPG Key ID: BE03111EB7ED6E2E
2 changed files with 241 additions and 159 deletions

View File

@ -26,7 +26,7 @@ jobs:
cpptrace/ci/setup-prerequisites.sh cpptrace/ci/setup-prerequisites.sh
- name: build and test - name: build and test
run: | run: |
python3 ci/test-all-configs.py --${{matrix.compiler}} python3 ci/test-all-configs.py --${{matrix.compiler}} --default-config
test-macos: test-macos:
runs-on: macos-14 runs-on: macos-14
strategy: strategy:
@ -45,18 +45,7 @@ jobs:
pip3 install colorama pip3 install colorama
- name: build and test - name: build and test
run: | run: |
python3 ci/test-all-configs.py --${{matrix.compiler}} python3 ci/test-all-configs.py --${{matrix.compiler}} --default-config
# - name: bundle artifacts
# if: always()
# run: |
# tar czfH bundle.tar.gz build
# - name: upload artifacts
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: build-macos-${{matrix.compiler}}${{matrix.shared}}
# path: bundle.tar.gz
# retention-days: 2
test-windows: test-windows:
runs-on: windows-2022 runs-on: windows-2022
strategy: strategy:
@ -66,6 +55,71 @@ jobs:
shared: [--shared, ""] shared: [--shared, ""]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.13.0
- name: dependencies
run: |
pip3 install colorama
- name: libdwarf
run: |
if("${{matrix.compiler}}" -eq "gcc") {
cd ..
cpptrace/ci/setup-prerequisites-mingw.ps1
}
- name: build and test
run: |
python3 ci/test-all-configs.py --${{matrix.compiler}} --default-config
test-linux-all-configurations:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
shared: [--shared, ""]
needs: test-linux
steps:
- uses: actions/checkout@v4
- name: dependencies
run: |
sudo apt install gcc-10 g++-10 libgcc-10-dev libunwind8-dev
pip3 install colorama
- name: libdwarf
run: |
cd ..
cpptrace/ci/setup-prerequisites.sh
- name: build and test
run: |
python3 ci/test-all-configs.py --${{matrix.compiler}}
test-macos-all-configurations:
runs-on: macos-14
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
shared: [--shared, ""]
needs: test-macos
steps:
- uses: actions/checkout@v4
- name: libdwarf
run: |
cd ..
cpptrace/ci/setup-prerequisites.sh
- name: dependencies
run: |
pip3 install colorama
- name: build and test
run: |
python3 ci/test-all-configs.py --${{matrix.compiler}}
test-windows-all-configurations:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
compiler: [msvc, clang, gcc]
shared: [--shared, ""]
needs: test-windows
steps:
- uses: actions/checkout@v4
- name: Enable Developer Command Prompt - name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.13.0 uses: ilammy/msvc-dev-cmd@v1.13.0
- name: dependencies - name: dependencies

View File

@ -332,39 +332,7 @@ def build_and_test_full_or_auto(matrix):
return good return good
def main(): def run_linux_matrix(compilers: list, shared: bool):
parser = argparse.ArgumentParser(
prog="Build in all configs",
description="Try building the library in all possible configurations for the current host"
)
parser.add_argument(
"--clang",
action="store_true"
)
parser.add_argument(
"--gcc",
action="store_true"
)
parser.add_argument(
"--msvc",
action="store_true"
)
parser.add_argument(
"--all",
action="store_true"
)
parser.add_argument(
"--shared",
action="store_true"
)
args = parser.parse_args()
if platform.system() == "Linux":
compilers = []
if args.clang or args.all:
compilers.append("clang++-14")
if args.gcc or args.all:
compilers.append("g++-10")
matrix = { matrix = {
"compiler": compilers, "compiler": compilers,
"target": ["Debug"], "target": ["Debug"],
@ -387,25 +355,23 @@ def main():
"CPPTRACE_DEMANGLE_WITH_CXXABI", "CPPTRACE_DEMANGLE_WITH_CXXABI",
#"CPPTRACE_DEMANGLE_WITH_NOTHING", #"CPPTRACE_DEMANGLE_WITH_NOTHING",
], ],
"shared": ["On" if args.shared else "Off"] "shared": ["On" if shared else "Off"]
} }
exclude = [] exclude = []
run_matrix(matrix, exclude, build_and_test) run_matrix(matrix, exclude, build_and_test)
def run_linux_default(compilers: list, shared: bool):
matrix = { matrix = {
"compiler": compilers, "compiler": compilers,
"target": ["Debug"], "target": ["Debug"],
"std": ["11", "20"], "std": ["11", "20"],
"config": [""], "config": [""],
"shared": ["On" if args.shared else "Off"] "shared": ["On" if shared else "Off"]
} }
exclude = [] exclude = []
run_matrix(matrix, exclude, build_and_test_full_or_auto) run_matrix(matrix, exclude, build_and_test_full_or_auto)
if platform.system() == "Darwin":
compilers = [] def run_macos_matrix(compilers: list, shared: bool):
if args.clang or args.all:
compilers.append("clang++")
if args.gcc or args.all:
compilers.append("g++-12")
matrix = { matrix = {
"compiler": compilers, "compiler": compilers,
"target": ["Debug"], "target": ["Debug"],
@ -426,27 +392,23 @@ def main():
"CPPTRACE_DEMANGLE_WITH_CXXABI", "CPPTRACE_DEMANGLE_WITH_CXXABI",
#"CPPTRACE_DEMANGLE_WITH_NOTHING", #"CPPTRACE_DEMANGLE_WITH_NOTHING",
], ],
"shared": ["On" if args.shared else "Off"] "shared": ["On" if shared else "Off"]
} }
exclude = [] exclude = []
run_matrix(matrix, exclude, build_and_test) run_matrix(matrix, exclude, build_and_test)
def run_macos_default(compilers: list, shared: bool):
matrix = { matrix = {
"compiler": compilers, "compiler": compilers,
"target": ["Debug"], "target": ["Debug"],
"std": ["11", "20"], "std": ["11", "20"],
"config": [""], "config": [""],
"shared": ["On" if args.shared else "Off"] "shared": ["On" if shared else "Off"]
} }
exclude = [] exclude = []
run_matrix(matrix, exclude, build_and_test_full_or_auto) run_matrix(matrix, exclude, build_and_test_full_or_auto)
if platform.system() == "Windows":
compilers = [] def run_windows_matrix(compilers: list, shared: bool):
if args.clang or args.all:
compilers.append("clang++")
if args.msvc or args.all:
compilers.append("cl")
if args.gcc or args.all:
compilers.append("g++")
matrix = { matrix = {
"compiler": compilers, "compiler": compilers,
"target": ["Debug"], "target": ["Debug"],
@ -467,7 +429,7 @@ def main():
"CPPTRACE_DEMANGLE_WITH_CXXABI", "CPPTRACE_DEMANGLE_WITH_CXXABI",
"CPPTRACE_DEMANGLE_WITH_NOTHING", "CPPTRACE_DEMANGLE_WITH_NOTHING",
], ],
"shared": ["On" if args.shared else "Off"] "shared": ["On" if shared else "Off"]
} }
exclude = [ exclude = [
{ {
@ -516,16 +478,82 @@ def main():
} }
] ]
run_matrix(matrix, exclude, build_and_test) run_matrix(matrix, exclude, build_and_test)
def run_windows_default(compilers: list, shared: bool):
matrix = { matrix = {
"compiler": compilers, "compiler": compilers,
"target": ["Debug"], "target": ["Debug"],
"std": ["11", "20"], "std": ["11", "20"],
"config": [""], "config": [""],
"shared": ["On" if args.shared else "Off"] "shared": ["On" if shared else "Off"]
} }
exclude = [] exclude = []
run_matrix(matrix, exclude, build_and_test_full_or_auto) run_matrix(matrix, exclude, build_and_test_full_or_auto)
def main():
parser = argparse.ArgumentParser(
prog="Build in all configs",
description="Try building the library in all possible configurations for the current host"
)
parser.add_argument(
"--clang",
action="store_true"
)
parser.add_argument(
"--gcc",
action="store_true"
)
parser.add_argument(
"--msvc",
action="store_true"
)
parser.add_argument(
"--all",
action="store_true"
)
parser.add_argument(
"--shared",
action="store_true"
)
parser.add_argument(
"--default-config",
action="store_true"
)
args = parser.parse_args()
if platform.system() == "Linux":
compilers = []
if args.clang or args.all:
compilers.append("clang++-14")
if args.gcc or args.all:
compilers.append("g++-10")
if args.default_config:
run_linux_default(compilers, args.shared)
else:
run_linux_matrix(compilers, args.shared)
if platform.system() == "Darwin":
compilers = []
if args.clang or args.all:
compilers.append("clang++")
if args.gcc or args.all:
compilers.append("g++-12")
if args.default_config:
run_macos_default(compilers, args.shared)
else:
run_macos_matrix(compilers, args.shared)
if platform.system() == "Windows":
compilers = []
if args.clang or args.all:
compilers.append("clang++")
if args.msvc or args.all:
compilers.append("cl")
if args.gcc or args.all:
compilers.append("g++")
if args.default_config:
run_windows_default(compilers, args.shared)
else:
run_windows_matrix(compilers, args.shared)
global failed global failed
if failed: if failed:
print("🔴 Some checks failed") print("🔴 Some checks failed")