Improve GitHub actions #511
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: Windows | |
on: | |
push: | |
branches: [ master, '*-ci' ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build_windows: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: ["windows-2022"] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
java-version: ["8"] | |
include: | |
- os: "windows-2022" | |
python-version: "3.8" | |
java-version: "11" | |
- os: "windows-2022" | |
python-version: "3.8" | |
java-version: "17" | |
name: OS ${{matrix.os}}, Python ${{matrix.python-version}}, Java ${{matrix.java-version}} | |
env: | |
CPPCHECK_HOME: "/c/Program Files/Cppcheck" | |
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 | |
MINGW64_TOOLCHAIN_ROOT: "/c/ProgramData/mingw64/mingw64" | |
MSVC_CMAKE_TOOLSET: "v141" | |
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: Convert environment variables to POSIX paths | |
run: | | |
echo "SPOTBUGS_HOME=/${SPOTBUGS_HOME}" | sed -e 's/\\/\//g' -e 's/://' >> ${GITHUB_ENV} | |
echo "NU_HTML_VALIDATOR=/${NU_HTML_VALIDATOR}" | sed -e 's/\\/\//g' -e 's/://' >> ${GITHUB_ENV} | |
echo "JAVA_HOME=/${JAVA_HOME}" | sed -e 's/\\/\//g' -e 's/://' >> ${GITHUB_ENV} | |
shell: bash | |
- name: Set ANT variable | |
run: | | |
echo "ANT=/${ANT_HOME}/bin/ant" | sed -e 's/\\/\//g' -e 's/://' >> ${GITHUB_ENV} | |
shell: bash | |
- 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: Install dependecies | |
run: | | |
choco install wget | |
choco install doxygen.portable | |
choco install graphviz | |
choco install zip | |
choco install mingw --version 13.2.0 | |
shell: bash | |
- name: Install specific version of C++ static code analysis tool (cppcheck) | |
run: choco install cppcheck --version=2.6 | |
- name: Install specific version of Java static code analysis tool (spotbugs) | |
run: | | |
wget -P "${{github.workspace}}" https://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/4.8.2/spotbugs-4.8.2.zip | |
unzip "${{github.workspace}}\spotbugs-4.8.2.zip" | |
- name: Install specific version of HTML validator (v.Nu) | |
run: | | |
wget -P "${{github.workspace}}" https://github.com/validator/validator/releases/download/20.6.30/vnu.jar_20.6.30.zip | |
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: choco install xsltproc | |
- name: Build Zserio | |
run: scripts/build.sh all-windows64-mingw cpp_rt-windows64-msvc | |
shell: bash | |
env: | |
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Release" | |
- name: Build Zserio C++ runtime (Debug Build) | |
run: scripts/build.sh cpp_rt-windows64-mingw cpp_rt-windows64-msvc | |
shell: bash | |
env: | |
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Debug" | |
- name: Pack Zserio release | |
run: scripts/release.sh | |
shell: bash | |
- name: Run Zserio tests | |
# -DZSERIO_ENABLE_WERROR=1 fails for mingw because of false positive warning | |
run: | | |
scripts/test.sh all-windows64-mingw cpp-windows64-msvc | |
shell: bash | |
env: | |
CMAKE_EXTRA_ARGS: "-DCMAKE_BUILD_TYPE=Release" | |
- name: Run Zserio tests (Debug Build) | |
# -DZSERIO_ENABLE_WERROR=1 fails for mingw because of false positive warning | |
# allocation tests do not work for MSVC Debug | |
run: | | |
scripts/test.sh cpp-windows64-mingw | |
shell: bash | |
env: | |
CMAKE_EXTRA_ARGS: "-DCMAKE_BUILD_TYPE=Debug" | |
- name: Run Zserio integration tests for repeated generation | |
run: scripts/test_gen.sh all-windows64-mingw cpp-windows64-msvc | |
shell: bash | |
- name: Run Zserio API compatibility checks | |
run: scripts/test_compat_api.sh java python cpp-windows64-msvc | |
shell: bash | |
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-windows64-mingw cpp-windows64-msvc 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 | |
shell: bash | |
- name: Run Zserio benchmarks | |
run: | | |
scripts/benchmark.sh cpp-windows64-mingw cpp-windows64-msvc python python-cpp java \ | |
--num-iterations 1 | |
shell: bash | |
- 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/**/*.pyd | |
build/runtime_libs/cpp/**/runtime/*.a | |
build/runtime_libs/cpp/**/runtime/**/*.lib |