Improve GitHub actions #492
Workflow file for this run
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: Linux | |
on: | |
push: | |
branches: [ master, '*-ci' ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build_linux: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: ["ubuntu-20.04"] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
java-version: ["8"] | |
include: | |
- os: "ubuntu-20.04" | |
clang-version-suffix: "-11" | |
- os: "ubuntu-20.04" | |
python-version: "3.8" | |
java-version: "11" | |
clang-version-suffix: "-11" | |
- os: "ubuntu-20.04" | |
python-version: "3.8" | |
java-version: "17" | |
clang-version-suffix: "-11" | |
- os: "ubuntu-22.04" | |
python-version: "3.8" | |
java-version: "8" | |
clang-version-suffix: "-14" | |
name: OS ${{matrix.os}}, Python ${{matrix.python-version}}, Java ${{matrix.java-version}} | |
env: | |
CPPCHECK_HOME: "${{github.workspace}}/cppcheck-2.6" | |
SPOTBUGS_HOME: "${{github.workspace}}/spotbugs-4.8.2" | |
PYLINT_ENABLED: 1 | |
MYPY_ENABLED: 1 | |
NU_HTML_VALIDATOR: "${{github.workspace}}/vnu-20.6.30/vnu.jar" | |
XMLLINT_ENABLED: 1 | |
CLANG_VERSION_SUFFIX: "${{matrix.clang-version-suffix}}" | |
CMAKE_BUILD_OPTIONS: "-j2" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Java ${{matrix.java-version}} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{matrix.java-version}} | |
- name: Set up Python ${{matrix.python-version}} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install virtualenv | |
python -m pip install gcovr | |
- name: Workaround for 'Unable to connect to ppa.launchpad.net' failure during installation | |
run: sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="300" | |
- name: Install dependencies | |
run: sudo apt-get install cmake doxygen graphviz g++-multilib | |
- name: Install specific version of C++ static code analysis tool (cppcheck) | |
run: | | |
wget https://github.com/danmar/cppcheck/archive/2.6.tar.gz -P "${GITHUB_WORKSPACE}" -O cppcheck-2.6.tar.gz | |
tar -xf "${GITHUB_WORKSPACE}"/cppcheck-2.6.tar.gz | |
mkdir "${GITHUB_WORKSPACE}/cppcheck-2.6/build" | |
pushd "${GITHUB_WORKSPACE}/cppcheck-2.6/build" | |
cmake .. -DHAVE_RULES=ON -DUSE_MATCHCOMPILER=ON \ | |
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}"/cppcheck-2.6 \ | |
-DCMAKE_INSTALL_BINDIR=. \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DFILESDIR=. | |
cmake --build . --target install | |
popd | |
- name: Install specific version of Java static code analysis tool (spotbugs) | |
run: | | |
wget https://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/4.8.2/spotbugs-4.8.2.zip -P "${GITHUB_WORKSPACE}" | |
unzip "${GITHUB_WORKSPACE}"/spotbugs-4.8.2.zip | |
- name: Install specific version of HTML validator (v.Nu) | |
run: | | |
wget https://github.com/validator/validator/releases/download/20.6.30/vnu.jar_20.6.30.zip -P "${GITHUB_WORKSPACE}" | |
unzip "${GITHUB_WORKSPACE}"/vnu.jar_20.6.30.zip -d "${GITHUB_WORKSPACE}" | |
mv "${GITHUB_WORKSPACE}"/dist "${GITHUB_WORKSPACE}"/vnu-20.6.30 | |
- name: Install XML validator (xmllint) | |
run: sudo apt-get install libxml2-utils | |
- name: Build Zserio | |
run: scripts/build.sh all-linux64-gcc cpp_rt-linux32-gcc cpp_rt-linux64-clang cpp_rt-linux32-clang | |
env: | |
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Release" | |
- name: Build Zserio C++ runtime (Debug Build) | |
run: | | |
if [ -f "`which clang-tidy-14`" ] ; then | |
export CLANG_TIDY_BIN=clang-tidy-14 | |
fi | |
# sanitizers do not work on cpp_rt-linux32-clang when cross-compiling | |
scripts/build.sh cpp_rt-linux64-gcc cpp_rt-linux32-gcc cpp_rt-linux64-clang | |
env: | |
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Debug" | |
GCOVR_BIN: "gcovr" | |
LLVM_PROFDATA_BIN: "llvm-profdata${{matrix.clang-version-suffix}}" | |
LLVM_COV_BIN: "llvm-cov${{matrix.clang-version-suffix}}" | |
SANITIZERS_ENABLED: 1 | |
- name: Pack Zserio release | |
run: scripts/release.sh | |
- name: Run Zserio tests | |
# -DZSERIO_ENABLE_WERROR=1 fails for gcc because of false positive warning | |
run: | | |
scripts/test.sh all-linux64-gcc cpp-linux32-gcc cpp-linux64-clang cpp-linux32-clang | |
env: | |
CMAKE_EXTRA_ARGS: "-DCMAKE_BUILD_TYPE=Release" | |
- name: Run Zserio C++ tests (Debug Build) | |
# sanitizers do not work on cpp-linux32-clang when cross-compiling | |
run: | | |
if [ -f "`which clang-tidy-14`" ] ; then | |
export CLANG_TIDY_BIN=clang-tidy-14 | |
fi | |
scripts/test.sh cpp-linux32-gcc cpp-linux64-gcc cpp-linux64-clang | |
env: | |
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Debug" | |
SANITIZERS_ENABLED: 1 | |
- name: Run Zserio integration tests for repeated generation | |
run: | | |
scripts/test_gen.sh all-linux64-gcc cpp-linux32-gcc cpp-linux64-clang cpp-linux32-clang | |
- name: Run Zserio API compatibility checks | |
run: | | |
scripts/test_compat_api.sh java python cpp-linux64-clang | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
CPPCHECK_HOME: "" | |
SPOTBUGS_HOME: "" | |
PYLINT_ENABLED: 0 | |
MYPY_ENABLED: 0 | |
- name: Run Zserio performance tests | |
run: | | |
scripts/test_perf.sh cpp-linux64-gcc cpp-linux64-clang cpp-linux32-gcc cpp-linux32-clang \ | |
python python-cpp java \ | |
--source-dir test/others/gif/zs --source gif.zs \ | |
--blob-name gif.GifFile --blob-file test/data/others/gif/1pix.gif \ | |
--num-iterations 1000 --test-config READ_WRITE | |
- name: Run Zserio benchmarks | |
run: | | |
scripts/benchmark.sh cpp-linux64-gcc cpp-linux64-clang cpp-linux32-gcc cpp-linux32-clang \ | |
python python-cpp java --num-iterations 1 | |
- name: Archive Zserio release artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: zserio-release-${{matrix.os}}-${{matrix.python-version}} | |
path: release-* | |
- name: Archive Zserio build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: zserio-build-${{matrix.os}}-${{matrix.python-version}} | |
path: | | |
build/runtime_libs/python/zserio_cpp/**/*.so | |
build/runtime_libs/cpp/**/runtime/*.a |