Skip to content

Commit

Permalink
Additional testing
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasfertig committed Apr 5, 2024
1 parent 3665892 commit 37a42c6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
51 changes: 19 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ jobs:
- name: Cache Ninja and CMake
id: cache-ninja-and-cmake
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/ninja*
Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
- name: Cache Clang
id: cache-clang-binary
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/current
Expand Down Expand Up @@ -304,7 +304,7 @@ jobs:
- name: Cache grcov
id: cache-grcov-binary
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/grcov.exe
Expand Down Expand Up @@ -377,8 +377,6 @@ jobs:
shell: cmake -P {0}
continue-on-error: false
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake --build build
RESULT_VARIABLE result
Expand All @@ -398,8 +396,6 @@ jobs:
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
endif()
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake --build build --target tests
RESULT_VARIABLE result
Expand All @@ -418,8 +414,6 @@ jobs:
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
endif()
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build build --target coverage
RESULT_VARIABLE result
Expand All @@ -430,7 +424,7 @@ jobs:
- name: Upload code coverage info
if: matrix.config.coverage == 'Yes'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
file: ./build/filtered.info # don't use a absolute path on Windows with gitBash.
flags: ${{ matrix.config.archive_name }}
Expand Down Expand Up @@ -574,6 +568,14 @@ jobs:
run: |
cmake --build build
- name: Simple test
if: "((matrix.config.coverage != 'Yes') && (matrix.config.run_tests != 'Yes'))"
shell: docker-shell {0}
continue-on-error: false
run: |
./build/insights cppinsights/tests/SimpleCICompileTest.cpp
./build/insights --use-libc++ cppinsights/tests/SimpleCICompileTest.cpp
- name: Run tests
if: matrix.config.run_tests == 'Yes'
id: run_tests
Expand Down Expand Up @@ -609,30 +611,15 @@ jobs:
run: |
cmake --build build --target coverage
- name: Run coverage upload
- name: Upload code coverage info
if: matrix.config.coverage == 'Yes'
id: run_coverage_upload
continue-on-error: false
env:
LIBCXX: ${{ matrix.config.libcxx }}
shell: bash
run: |
if [ ! -f ${GITHUB_WORKSPACE}/build/filtered.info ]; then
echo -e "\033[1;31mlcov did not create filtered.info!\033[0m"
exit 1;
fi
if [ ! -s ${GITHUB_WORKSPACE}/build/filtered.info ]; then
echo -e "\033[1;31mlcov did create an empty filtered.info!\033[0m"
exit 1;
fi
flag="ubuntu-${{ matrix.arch }}"
if [ "Yes" == "${LIBCXX}" ]; then
flag="ubuntu-${{ matrix.arch }}-libcxx"
fi
# Uploading report to CodeCov
bash <(curl -s https://codecov.io/bash) -f ${GITHUB_WORKSPACE}/build/filtered.info -F ${flag} || echo "Codecov did not collect coverage reports"
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./build/filtered.info # don't use a absolute path on Windows with gitBash.
flags: ${{ matrix.config.archive_name }}-${{ matrix.arch }}-libcxx-${{ matrix.config.libcxx }}
fail_ci_if_error: true

- name: Create archive
if: matrix.config.upload == 'Yes'
Expand Down
8 changes: 8 additions & 0 deletions tests/SimpleCICompileTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <string>

int main()
{
std::string s{"Hello, CI!"};

return 1;
}
7 changes: 7 additions & 0 deletions tests/SimpleCICompileTest.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <string>

int main()
{
std::basic_string<char, std::char_traits<char>, std::allocator<char> > s = std::basic_string<char, std::char_traits<char>, std::allocator<char> >{"Hello, CI!"};
return 1;
}

0 comments on commit 37a42c6

Please sign in to comment.