Skip to content

Commit 816e907

Browse files
author
Matt Mitchell
committed
try decent-ci style testing on each branch on self-hosted runner
1 parent 6200824 commit 816e907

1 file changed

Lines changed: 127 additions & 0 deletions

File tree

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Self-Hosted Decent CI
2+
3+
on:
4+
pull_request:
5+
branches: [ develop ]
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
13+
14+
env:
15+
BUILD_DIR: build-decent-ci
16+
Python_REQUIRED_VERSION: "3.12.2"
17+
18+
jobs:
19+
build_and_test:
20+
name: GCC 13.3 build and split tests
21+
if: >-
22+
${{
23+
github.event.pull_request.head.repo.full_name == github.repository &&
24+
github.event.pull_request.head.repo.fork == false
25+
}}
26+
runs-on: [ self-hosted, linux, x64, ubuntu-24.04 ]
27+
28+
steps:
29+
- name: Checkout EnergyPlus
30+
uses: actions/checkout@v6
31+
with:
32+
ref: ${{ github.event.pull_request.head.sha }}
33+
persist-credentials: false
34+
35+
- name: Setup runner
36+
id: setup-runner
37+
uses: ./.github/actions/setup-runner
38+
with:
39+
python-version: ${{ env.Python_REQUIRED_VERSION }}
40+
python-arch: x64
41+
42+
- name: Select GCC 13.3 toolchain
43+
shell: bash
44+
run: |
45+
sudo apt-get -qq update
46+
sudo apt-get -qq install -y gcc-13 g++-13 gfortran-13
47+
48+
gcc_version="$(gcc-13 -dumpfullversion -dumpversion)"
49+
case "$gcc_version" in
50+
13.3*) ;;
51+
*)
52+
echo "::error::Expected GCC 13.3.x, found ${gcc_version}"
53+
exit 1
54+
;;
55+
esac
56+
57+
{
58+
echo "CC=$(command -v gcc-13)"
59+
echo "CXX=$(command -v g++-13)"
60+
echo "FC=$(command -v gfortran-13)"
61+
} >> "$GITHUB_ENV"
62+
gcc-13 --version
63+
g++-13 --version
64+
gfortran-13 --version
65+
66+
- name: Configure build
67+
shell: bash
68+
run: |
69+
cmake -S . -B "$BUILD_DIR" \
70+
-G Ninja \
71+
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
72+
-DCMAKE_C_COMPILER:FILEPATH="$CC" \
73+
-DCMAKE_CXX_COMPILER:FILEPATH="$CXX" \
74+
-DCMAKE_Fortran_COMPILER:FILEPATH="$FC" \
75+
-DLINK_WITH_PYTHON:BOOL=ON \
76+
-DPYTHON_CLI:BOOL=OFF \
77+
-DPython_REQUIRED_VERSION:STRING="$Python_REQUIRED_VERSION" \
78+
-DPython_ROOT_DIR:PATH="${{ steps.setup-runner.outputs.python-root-dir }}" \
79+
-DPython_EXECUTABLE:FILEPATH="${{ steps.setup-runner.outputs.python-executable }}" \
80+
-DBUILD_FORTRAN:BOOL=ON \
81+
-DBUILD_TESTING:BOOL=ON \
82+
-DENABLE_REGRESSION_TESTING:BOOL=OFF \
83+
-DCOMMIT_SHA:STRING="${{ github.event.pull_request.head.sha }}" \
84+
-DENABLE_GTEST_DEBUG_MODE:BOOL=OFF \
85+
-DENABLE_PCH:BOOL=OFF \
86+
-DFORCE_DEBUG_ARITHM_GCC_OR_CLANG:BOOL=ON \
87+
-DBUILD_PACKAGE:BOOL=OFF \
88+
-DDOCUMENTATION_BUILD:STRING=DoNotBuild
89+
90+
- name: Build
91+
shell: bash
92+
run: |
93+
echo "::add-matcher::./.github/workflows/cpp-problem-matcher.json"
94+
cmake --build "$BUILD_DIR" -j "${NPROC:-$(nproc)}"
95+
echo "::remove-matcher owner=gcc-problem-matcher::"
96+
97+
- name: Run unit tests
98+
working-directory: ${{ env.BUILD_DIR }}
99+
shell: bash
100+
run: |
101+
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
102+
103+
begin_group "Running non-integration CTests"
104+
if ctest -j "${NPROC:-$(nproc)}" --output-on-failure -E "integration.*"; then
105+
echo "::endgroup::"
106+
else
107+
echo "::endgroup::"
108+
begin_group "Re-running failed non-integration tests verbosely"
109+
ctest --rerun-failed -VV
110+
echo "::endgroup::"
111+
fi
112+
113+
- name: Run integration tests
114+
working-directory: ${{ env.BUILD_DIR }}
115+
shell: bash
116+
run: |
117+
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
118+
119+
begin_group "Running integration CTests"
120+
if ctest -j "${NPROC:-$(nproc)}" --output-on-failure -R "integration.*"; then
121+
echo "::endgroup::"
122+
else
123+
echo "::endgroup::"
124+
begin_group "Re-running failed integration tests verbosely"
125+
ctest --rerun-failed -VV
126+
echo "::endgroup::"
127+
fi

0 commit comments

Comments
 (0)