Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions: stop on first failure and cat ctest log #104

Merged
merged 20 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0e60afe
GitHub Actions: stop on first failure and cat ctest log
mattrm456 Dec 11, 2023
79c1f8a
GitHub Actions: cosmetica
mattrm456 Dec 11, 2023
813d0ad
GitHub Actions: do not tee to log files from standard makefile
mattrm456 Dec 11, 2023
54c4f68
GitHub Actions: tweak title
mattrm456 Dec 11, 2023
e42ff66
GitHub Actions: show environment
mattrm456 Dec 12, 2023
12d5c0b
GitHub Actions: only test native port name resolution if /etc/servces…
mattrm456 Dec 12, 2023
0188cc1
GitHub Actions: only test native port name resolution if /etc/servces…
mattrm456 Dec 12, 2023
8ca9143
GitHub Actions: only test native port name resolution if /etc/servces…
mattrm456 Dec 12, 2023
06d14de
GitHub Actions: only test native port name resolution if /etc/servces…
mattrm456 Dec 12, 2023
a8b2f68
GitHub Actions: only test native port name resolution if /etc/servces…
mattrm456 Dec 12, 2023
c32ee91
GitHub Actions: configure the build to indicate it runs during contin…
mattrm456 Dec 12, 2023
22d71e3
GitHub Actions: only test native port name resolution if /etc/servces…
mattrm456 Dec 12, 2023
5288383
GitHub Actions: debug test failures
mattrm456 Dec 12, 2023
20673aa
GitHub Actions: debug test failures
mattrm456 Dec 12, 2023
f945fdc
GitHub Actions: debug test failures
mattrm456 Dec 12, 2023
8ccb609
GitHub Actions: debug test failures
mattrm456 Dec 12, 2023
a9f8c5c
GitHub Actions: debug test failures
mattrm456 Dec 12, 2023
d2d30e8
GitHub Actions: debug test failures
mattrm456 Dec 14, 2023
56199ff
GitHub Actions: debug test failures
mattrm456 Dec 14, 2023
2ceedbb
GitHub Actions: debug test failures
mattrm456 Dec 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,43 @@ concurrency:

jobs:
build-check:
name: "Check whether NTF builds and passes unit tests"
name: "Linux"
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3

- name: Get cache name
- name: Cache-Identify
id: get-hash
run: echo "ntf_deps_hash=`cat .github/workflows/docker/build_deps.sh .github/workflows/docker/build_test_ntf.sh .github/workflows/docker/Dockerfile | shasum`" >> $GITHUB_OUTPUT

- name: Get cached dependencies docker image
- name: Cache-Lookup
id: cache-restore
uses: actions/cache/restore@v3
with:
path: ntf_deps_image.tar.gz
key: ${{ steps.get-hash.outputs.ntf_deps_hash }}

- name: Build dependencies docker image
- name: Cache-Build
if: steps.cache-restore.outputs.cache-hit != 'true'
run: docker build --tag ntf-deps --platform linux/amd64 .github/workflows/docker

- name: Load dependencies docker image from cache
- name: Cache-Restore
if: steps.cache-restore.outputs.cache-hit == 'true'
run: docker load < ntf_deps_image.tar.gz

- name: Save built dependencies docker image
- name: Cache-Save
if: steps.cache-restore.outputs.cache-hit != 'true'
run: docker save ntf-deps:latest | gzip > ntf_deps_image.tar.gz

- name: Cache built dependencies docker image
- name: Cache-Commit
id: cache-save
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ntf_deps_image.tar.gz
key: ${{ steps.get-hash.outputs.ntf_deps_hash }}

- name: Run dependencies docker container
- name: Build
id: ntf-deps-run
run: docker run -v $(pwd):/workspace/ntf-core --name ntf-deps ntf-deps /bin/bash -c "/workspace/ntf-core/.github/workflows/docker/build_test_ntf.sh"
92 changes: 74 additions & 18 deletions .github/workflows/docker/build_test_ntf.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,84 @@
#!/bin/bash
#!/usr/bin/env bash

set -e
# configure() {
# cd /workspace
# PATH="$PATH:$(realpath srcs/bde-tools/bin)"
# export PATH
# eval "$(bbs_build_env -u opt_64_cpp17)"
# }

configure() {
cd /workspace
PATH="$PATH:$(realpath srcs/bde-tools/bin)"
export PATH
eval "$(bbs_build_env -u opt_64_cpp17)"
}
build_ntf() {
local rc=0

build_ntf() {
cd /workspace/ntf-core
sed -i s/CMakeLists.txt//g ./configure
./configure --prefix /opt/bb
make -j8
make test | tee test.log

if cat test.log | grep -q "Errors while running CTest"; then
echo "There are errors while running UTs, exiting..."
exit 1
rc=${?}
if [ ${rc} -ne 0 ]; then
echo "Failed to change directory: rc = ${rc}"
exit ${rc}
fi

local jobs=$(getconf _NPROCESSORS_ONLN)

echo "Cores: ${concurrency}"
free -h

echo "Environment"
env

echo "File: /etc/hosts"
cat /etc/hosts

echo "File: /etc/services"
cat /etc/services

echo "File: /etc/resolv.conf"
cat /etc/resolv.conf

unset DISTRIBUTION_REFROOT
unset PREFIX

./configure --prefix /opt/bb \
--output /workspace/ntf-core/build \
--jobs ${jobs} \
--standalone \
--without-warnings \
--without-warnings-as-errors \
--from-continuous-integration
rc=${?}
if [ ${rc} -ne 0 ]; then
echo "Failed to configure: rc = ${rc}"
exit ${rc}
fi

make build
rc=${?}
if [ ${rc} -ne 0 ]; then
echo "Failed to build: rc = ${rc}"
exit ${rc}
fi

make build_test
rc=${?}
if [ ${rc} -ne 0 ]; then
echo "Failed to build tests: rc = ${rc}"
exit ${rc}
fi

make test
rc=${?}
if [ ${rc} -ne 0 ]; then
cat /workspace/ntf-core/build/Testing/Temporary/LastTest.log
echo "Failed to run tests successfully: rc = ${rc}"
exit ${rc}
fi

make install
rc=${?}
if [ ${rc} -ne 0 ]; then
echo "Failed to install: rc = ${rc}"
exit ${rc}
fi
}

configure
# configure
build_ntf
15 changes: 7 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ while true ; do

--from-continuous-integration)
NTF_CONFIGURE_FROM_CONTINUOUS_INTEGRATION=1
NTF_CONFIGURE_VERBOSE=1
shift ;;
--from-packaging)
NTF_CONFIGURE_FROM_PACKAGING=1 ; shift ;;
Expand Down Expand Up @@ -948,7 +947,7 @@ cd ${NTF_CONFIGURE_OUTPUT}

echo "${NTF_CONFIGURE_CMAKE}${NTF_CONFIGURE_CMAKE_OPTION_DISTRIBUTION_REFROOT}${NTF_CONFIGURE_CMAKE_OPTION_UFID}${NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE}${NTF_CONFIGURE_CMAKE_OPTION_INSTALL_PREFIX}${NTF_CONFIGURE_CMAKE_OPTION_PREFIX_PATH}${NTF_CONFIGURE_CMAKE_OPTION_VERBOSE_MAKEFILE} -DCMAKE_TOOLCHAIN_FILE:PATH=${NTF_CONFIGURE_REPOSITORY}/toolchain.cmake -G \"${NTF_CONFIGURE_GENERATOR}\" -S ${NTF_CONFIGURE_REPOSITORY}"

${NTF_CONFIGURE_CMAKE}${NTF_CONFIGURE_CMAKE_OPTION_DISTRIBUTION_REFROOT}${NTF_CONFIGURE_CMAKE_OPTION_UFID}${NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE}${NTF_CONFIGURE_CMAKE_OPTION_INSTALL_PREFIX}${NTF_CONFIGURE_CMAKE_OPTION_PREFIX_PATH}${NTF_CONFIGURE_CMAKE_OPTION_VERBOSE_MAKEFILE} -DCMAKE_TOOLCHAIN_FILE:PATH=${NTF_CONFIGURE_REPOSITORY}/toolchain.cmake -G "${NTF_CONFIGURE_GENERATOR}" -S ${NTF_CONFIGURE_REPOSITORY} 2>&1 | tee -a ${NTF_CONFIGURE_LOG_PREFIX}configure.log
${NTF_CONFIGURE_CMAKE}${NTF_CONFIGURE_CMAKE_OPTION_DISTRIBUTION_REFROOT}${NTF_CONFIGURE_CMAKE_OPTION_UFID}${NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE}${NTF_CONFIGURE_CMAKE_OPTION_INSTALL_PREFIX}${NTF_CONFIGURE_CMAKE_OPTION_PREFIX_PATH}${NTF_CONFIGURE_CMAKE_OPTION_VERBOSE_MAKEFILE} -DCMAKE_TOOLCHAIN_FILE:PATH=${NTF_CONFIGURE_REPOSITORY}/toolchain.cmake -G "${NTF_CONFIGURE_GENERATOR}" -S ${NTF_CONFIGURE_REPOSITORY}
if [ ${?} -ne 0 ]; then
echo "Failed to configure"
exit 1
Expand All @@ -966,21 +965,21 @@ MAKEFLAGS+=${NTF_CONFIGURE_MAKEFLAGS}
all: build

build:
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel ${NTF_CONFIGURE_JOBS} 2>&1 | tee -a ${NTF_CONFIGURE_LOG_PREFIX}build.log
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel ${NTF_CONFIGURE_JOBS}

build_test:
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel ${NTF_CONFIGURE_JOBS} --target build_test 2>&1 | tee -a ${NTF_CONFIGURE_LOG_PREFIX}build.log
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel ${NTF_CONFIGURE_JOBS} --target build_test

test:
@export CTEST_PARALLEL_LEVEL=1
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel ${NTF_CONFIGURE_JOBS} --target build_test 2>&1 | tee -a ${NTF_CONFIGURE_LOG_PREFIX}build.log
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel 1 --target test 2>&1 | tee -a ${NTF_CONFIGURE_LOG_PREFIX}test.log
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel ${NTF_CONFIGURE_JOBS} --target build_test
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel 1 --target test

test_usage:
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel 1 --target test_usage 2>&1 | tee -a ${NTF_CONFIGURE_LOG_PREFIX}test_usage.log
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel 1 --target test_usage

coverage:
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel 1 --target coverage 2>&1 | tee -a ${NTF_CONFIGURE_LOG_PREFIX}test.log
@${NTF_CONFIGURE_CMAKE} --build ${NTF_CONFIGURE_OUTPUT} --parallel 1 --target coverage

install:
@${NTF_CONFIGURE_CMAKE} --install ${NTF_CONFIGURE_OUTPUT} --prefix ${NTF_CONFIGURE_INSTALL_PREFIX_OVERRIDE}
Expand Down
8 changes: 8 additions & 0 deletions groups/ntc/ntcdns/ntcdns_database.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,10 @@ NTCCFG_TEST_CASE(3)
// Concern: Host database configurations from "/etc/hosts".
// Plan:

if (!ntscfg::Platform::hasHostDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -2158,6 +2162,10 @@ NTCCFG_TEST_CASE(4)
// Concern: Port database configurations from "/etc/services".
// Plan:

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down
56 changes: 56 additions & 0 deletions groups/ntc/ntcdns/ntcdns_resolver.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,14 @@ NTCCFG_TEST_CASE(6)
// Concern: Test 'getIpAddress' from database.
// Plan:

if (!ntscfg::Platform::hasHostDatabase()) {
return;
}

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -731,6 +739,14 @@ NTCCFG_TEST_CASE(7)
// Concern: Test 'getDomainName' from database.
// Plan:

if (!ntscfg::Platform::hasHostDatabase()) {
return;
}

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -832,6 +848,14 @@ NTCCFG_TEST_CASE(8)
// Concern: Test 'getPort' from database.
// Plan:

if (!ntscfg::Platform::hasHostDatabase()) {
return;
}

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -929,6 +953,14 @@ NTCCFG_TEST_CASE(9)
// Concern: Test 'getServiceName' from database.
// Plan:

if (!ntscfg::Platform::hasHostDatabase()) {
return;
}

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -1027,6 +1059,14 @@ NTCCFG_TEST_CASE(10)
// Concern: Test 'getEndpoint' from database.
// Plan:

if (!ntscfg::Platform::hasHostDatabase()) {
return;
}

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -1734,6 +1774,10 @@ NTCCFG_TEST_CASE(18)
// Concern: Test 'getPort' from system.
// Plan:

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -1810,6 +1854,10 @@ NTCCFG_TEST_CASE(19)
// Concern: Test 'getServiceName' from system.
// Plan:

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down Expand Up @@ -1887,6 +1935,14 @@ NTCCFG_TEST_CASE(20)
// Concern: Test 'getEndpoint' from system.
// Plan:

if (!ntscfg::Platform::hasHostDatabase()) {
return;
}

if (!ntscfg::Platform::hasPortDatabase()) {
return;
}

NTCI_LOG_CONTEXT();

ntsa::Error error;
Expand Down
Loading
Loading