logs_on_demand #372
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'logs_on_demand' | |
concurrency: | |
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
jobs: | |
# Linux build, test, and publish | |
linux-install: | |
name: "Linux | Install | ${{ matrix.compiler }} | ${{ matrix.config }}" | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- gcc | |
config: | |
- release | |
env: | |
artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
# Fetch tags for CMakeLists version check | |
# https://github.com/actions/checkout/issues/701 | |
- name: Git fetch tags | |
run: git fetch --tags origin | |
- uses: ./.github/linux-setup | |
with: | |
compiler: ${{ matrix.compiler }} | |
ccache-key: linux-install-${{ matrix.compiler }}-${{ matrix.config }} | |
- name: Build, install & test | |
run: | | |
if [ "${{ matrix.config }}" == "debug" ]; then | |
export BUILD_TYPE=Debug | |
export CMAKE_ADDITIONAL_ARGS=-DSURELOG_WITH_TCMALLOC=Off | |
else | |
export BUILD_TYPE=Release | |
export CMAKE_ADDITIONAL_ARGS= | |
fi | |
export INSTALL_DIR=`pwd`/install | |
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $CMAKE_ADDITIONAL_ARGS -S . -B build | |
cmake --build build -j $(nproc) | |
cmake --install build | |
# cmake --build build --target UnitTests -j $(nproc) | |
# pushd build && ctest --output-on-failure && popd | |
# rm -rf build # make sure we only see installation artifacts | |
# this shouldnt be necessary, and can't be reproduced outside CI | |
# export CMAKE_PREFIX_PATH=$INSTALL_DIR | |
# cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DINSTALL_DIR=$INSTALL_DIR -S tests/TestInstall -B tests/TestInstall/build | |
# cmake --build tests/TestInstall/build -j $(nproc) | |
# echo "-- pkg-config content --" | |
# cat $INSTALL_DIR/lib/pkgconfig/Surelog.pc | |
# PREFIX=$INSTALL_DIR make test_install_pkgconfig | |
- name: Prepare build artifacts | |
run: | | |
mkdir artifacts | |
mv install ${{ env.artifact-name }} | |
tar czfp artifacts/${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }} | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifact-name }} | |
path: artifacts/${{ env.artifact-name }}.tar.gz | |
# Linux regression | |
linux-regression: | |
name: "Linux | Regression | ${{ matrix.compiler }} | ${{ matrix.config }} [${{ matrix.shard }}]" | |
runs-on: ubuntu-20.04 | |
needs: linux-install | |
strategy: | |
fail-fast: false | |
matrix: | |
num_shards: [8] | |
shard: [0, 1, 2, 3, 4, 5, 6, 7] | |
compiler: | |
- gcc | |
config: | |
- release | |
env: | |
build-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }} | |
regression-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}-regression-${{ matrix.shard }} | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -qq && | |
sudo apt install -y google-perftools libgoogle-perftools-dev | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
architecture: x64 | |
- name: Setup Python Packages | |
run: | | |
pip3 install orderedmultidict | |
pip3 install psutil | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.build-artifact-name }} | |
- name: Run regression ${{ matrix.shard }}/${{ matrix.num_shards }} | |
timeout-minutes: 120 | |
run: | | |
tar xzfp ${{ env.build-artifact-name }}.tar.gz | |
mv ${{ env.build-artifact-name }} build | |
rm ${{ env.build-artifact-name }}.tar.gz | |
python3 scripts/regression.py run \ | |
--uhdm-lint-filepath bin/uhdm-lint \ | |
--jobs $(nproc) \ | |
--show-diffs \ | |
--num_shards=${{ matrix.num_shards }} \ | |
--shard=${{ matrix.shard }} | |
git status | |
- name: Prepare regression artifacts | |
if: always() | |
run: | | |
cd build | |
mv regression ${{ env.regression-artifact-name }} | |
find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T - | |
- name: Upload regression artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.regression-artifact-name }} | |
path: build/${{ env.regression-artifact-name }}.tar.gz | |
# Collect statistics | |
collect-statistics: | |
name: "Linux | Statistics | ${{ matrix.compiler }} | ${{ matrix.config }}" | |
runs-on: ubuntu-20.04 | |
needs: linux-regression | |
if: "!cancelled()" | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- gcc | |
config: | |
- release | |
env: | |
regression-artifact-pattern: "sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}-regression-*" | |
statistics-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}-statistics | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
architecture: x64 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
sparse-checkout: scripts/scan_errors.py | |
sparse-checkout-cone-mode: false | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
pattern: ${{ env.regression-artifact-pattern }} | |
merge-multiple: true | |
- name: Run scanner | |
timeout-minutes: 30 | |
run: | | |
ls -lR | |
python3 scripts/scan_errors.py artifacts ${{ github.run_number }} | |
mv artifacts/sl-${{ github.run_number }}.txt ${{ env.statistics-artifact-name }}.log | |
- name: Upload regression artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.statistics-artifact-name }} | |
path: ${{ env.statistics-artifact-name }}.log | |
# Code formatting | |
CodeFormatting: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Dependencies | |
run: | | |
sudo apt-get install clang-format | |
clang-format --version | |
- name: Run formatting style check | |
run: ./.github/bin/run-clang-format.sh | |
# Code Tideness | |
ClangTidy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update -qq | |
sudo apt -qq -y install clang-tidy-12 \ | |
g++-9 default-jre cmake \ | |
uuid-dev build-essential | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
architecture: x64 | |
- name: Setup Python Packages | |
run: | | |
pip3 install orderedmultidict | |
pip3 install psutil | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Use ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: clang-tidy-codegen | |
- name: Configure shell | |
run: | | |
echo 'PATH=/usr/lib/ccache:'"$PATH" >> $GITHUB_ENV | |
- name: Prepare source | |
run: | | |
make run-cmake-release | |
make -j2 -C build GenerateParser | |
make -j2 -C build GenerateParserListeners | |
make -j2 -C build GenerateCacheSerializers | |
ln -sf build/compile_commands.json . | |
- name: Run clang tidy | |
run: | | |
./.github/bin/run-clang-tidy.sh limited |