Testing - Extend GH Action on GitHub #49
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
# This workflow builds and tests OCCT on multiple platforms (Windows, macOS, Linux with Clang, and Linux with GCC). | |
# It is triggered on pull requests to any branch. | |
# The workflow includes steps to prepare and build the project on each platform, run tests, and upload the results. | |
# Concurrency is set to ensure that only one instance of the workflow runs per pull request at a time. | |
name: Build and Test OCCT on Multiple Platforms | |
on: | |
pull_request: | |
branches: | |
- '**' | |
push: | |
branches: | |
- 'master' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
jobs: | |
prepare-and-build-linux-clang-x64: | |
name: Prepare and Build on Ubuntu with Clang (x64) | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.1.7 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y tcl-dev tk-dev cmake clang gcc g++ make libbtbb-dev libx11-dev libglu1-mesa-dev tcllib tcl-thread tcl libvtk9-dev libopenvr-dev libdraco-dev libfreeimage-dev libegl1-mesa-dev libgles2-mesa-dev libfreetype-dev mesa-utils libgl1-mesa-dev libxext-dev libxrandr-dev vulkan-tools libvulkan-dev xvfb mesa-utils libgl1-mesa-dri xkb-data | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y xserver-xorg-video-dummy ninja-build | |
- name: Install clang | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 20 | |
- name: Start Xvfb | |
run: Xvfb :99 -screen 0 1920x1080x24 & | |
- name: Install rapidjson | |
run: | | |
wget https://github.com/Tencent/rapidjson/archive/858451e5b7d1c56cf8f6d58f88cf958351837e53.zip -O rapidjson.zip | |
unzip rapidjson.zip | |
- name: Configure OCCT | |
run: | | |
mkdir -p build | |
cd build | |
cmake -G "Ninja" \ | |
-D CMAKE_C_COMPILER=clang-20 \ | |
-D CMAKE_CXX_COMPILER=clang++-20 \ | |
-D BUILD_USE_PCH=ON \ | |
-D BUILD_INCLUDE_SYMLINK=ON \ | |
-D USE_TK=ON \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
-D INSTALL_DIR=${{ github.workspace }}/install \ | |
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \ | |
-D USE_FREETYPE=ON \ | |
-D USE_DRACO=ON \ | |
-D USE_FFMPEG=OFF \ | |
-D USE_FREEIMAGE=ON \ | |
-D USE_GLES2=ON \ | |
-D USE_XLIB=ON \ | |
-D USE_OPENVR=ON \ | |
-D USE_VTK=ON \ | |
-D USE_TBB=OFF \ | |
-D USE_RAPIDJSON=ON \ | |
-D USE_OPENGL=ON .. | |
- name: Install OCCT | |
run: | | |
cd build | |
cmake --build . --target install --config Release | |
- name: Upload install directory | |
uses: actions/upload-artifact@v4.4.3 | |
with: | |
name: install-linux-clang-x64 | |
path: install | |
retention-days: 7 | |
test-linux-clang-x64: | |
name: Test on Linux with Clang (x64) | |
runs-on: ubuntu-24.04 | |
needs: prepare-and-build-linux-clang-x64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.1.7 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y tcl-dev tk-dev cmake clang gcc g++ make libbtbb-dev libx11-dev libglu1-mesa-dev tcllib tcl-thread tcl libvtk9-dev libopenvr-dev libdraco-dev libfreeimage-dev libegl1-mesa-dev libgles2-mesa-dev libfreetype-dev mesa-utils libgl1-mesa-dev libxext-dev libxrandr-dev vulkan-tools libvulkan-dev xvfb mesa-utils libgl1-mesa-dri xkb-data | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y xserver-xorg-video-dummy | |
- name: Start Xvfb | |
run: Xvfb :99 -screen 0 1920x1080x24 & | |
- name: Set DISPLAY environment variable | |
run: echo "DISPLAY=:99" >> $GITHUB_ENV | |
- name: Download test data | |
run: | | |
cd data | |
wget https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_8_0/opencascade-dataset-7.8.0.tar.xz | |
tar -xf opencascade-dataset-7.8.0.tar.xz | |
- name: Download and extract install directory | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: install-linux-clang-x64 | |
path: install | |
- name: Set execute permissions on DRAWEXE | |
run: chmod +x install/bin/DRAWEXE | |
- name: Run tests | |
run: | | |
cd install | |
cd bin | |
source env.sh | |
./DRAWEXE -v -c testgrid caf presentation | |
shell: bash | |
env: | |
DISPLAY: :99 | |
LIBGL_ALWAYS_SOFTWARE: 1 | |
CSF_TestScriptsPath: ${{ github.workspace }}/tests | |
CSF_TestDataPath: ${{ github.workspace }}/data | |
- name: Upload test results | |
uses: actions/upload-artifact@v4.4.3 | |
id: artifact-upload-step | |
with: | |
name: results-linux-clang-x64 | |
path: install/bin/results | |
retention-days: 15 |