Skip to content

Feature/auto select qtmtd #7480

Feature/auto select qtmtd

Feature/auto select qtmtd #7480

Workflow file for this run

name: compiler-build
on: [push, pull_request]
jobs:
build:
name: build-${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
matrix:
config:
- {name: x86_64-macos, os: macos-11, cmakeArgs: '', buildType: Release}
- {name: x86_64-linux, os: ubuntu-20.04, cmakeArgs: '', buildType: Release}
- {name: x86_64-windows, os: windows-latest, arch: x64, cmakeArgs: '', buildType: Release}
steps:
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Set up build environment (Windows, Visual Studio)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.config.arch}}
if: runner.os == 'Windows'
- name: Set up build environment (Macos)
run: |
brew install sunnycase/core/[email protected]
if: runner.os == 'Macos'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install Conan
run: pip install conan==1.59.0
- name: Configure Conan (Linux)
run: |
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
echo "CC=gcc-10" >> $GITHUB_ENV
echo "CXX=g++-10" >> $GITHUB_ENV
if: runner.os == 'Linux'
- name: Configure CMake
shell: bash
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.config.buildType}} ${{matrix.config.cmakeArgs}} -DBUILD_TESTING=ON -DPython3_ROOT_DIR=${pythonLocation}
- name: Build & Install
run: |
cmake --build build --config ${{matrix.config.buildType}}
cmake --install build --prefix install
- name: CTest
working-directory: ${{github.workspace}}/build/tests/kernels
run: ctest -C ${{matrix.config.buildType}}
- name: Upload nncase Build Artifact
uses: actions/upload-artifact@v3
with:
name: nncase-${{matrix.config.name}}
path: ${{github.workspace}}/install
if-no-files-found: error
test-compiler:
needs: [build]
name: test-${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
matrix:
config:
- {name: x86_64-macos, os: macos-11, shell: bash}
- {name: x86_64-linux, os: ubuntu-20.04, shell: bash}
- {name: x86_64-windows, os: windows-latest, shell: bash}
env:
VULKANSDK_VER: 1.3.268.0
steps:
- uses: actions/checkout@v3
- name: Set up test environment (macOS)
run: |
brew install sunnycase/core/[email protected]
aria2c --parameterized-uri=true https://{sdk.lunarg.com/sdk/download/${VULKANSDK_VER}/mac,distfiles.macports.org/MoltenVK}/vulkansdk-macos-${VULKANSDK_VER}.dmg
hdiutil attach ./vulkansdk-macos-*.dmg
sudo /Volumes/vulkansdk-macos-*/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $HOME/VulkanSDK --accept-licenses --default-answer --confirm-command install
hdiutil detach /Volumes/vulkansdk-macos-*
echo "VULKAN_SDK=$HOME/VulkanSDK/macOS" >> $GITHUB_ENV
wget https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-macos-10.15-x86_64.zip -O swiftshader.zip
unzip swiftshader.zip
sudo cmake -E make_directory /usr/local/share/vulkan/icd.d
sudo cp lib/* /usr/local/share/vulkan/icd.d
echo "PYTHONPATH=$GITHUB_WORKSPACE/install/lib:$GITHUB_WORKSPACE/install/python:$GITHUB_WORKSPACE/tests" >> $GITHUB_ENV
if: runner.os == 'macOS'
- name: Set up test environment (Linux)
run: |
wget https://sdk.lunarg.com/sdk/download/${VULKANSDK_VER}/linux/vulkansdk-linux-x86_64-${VULKANSDK_VER}.tar.gz -O vulkansdk.tar.gz
tar xf vulkansdk.tar.gz
sudo cp -P ${VULKANSDK_VER}/x86_64/lib/libvulkan.so* /usr/local/lib/
wget https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-ubuntu-18.04-x86_64.zip -O swiftshader.zip
unzip swiftshader.zip
sudo cmake -E make_directory /usr/local/share/vulkan/icd.d
sudo cp lib/* /usr/local/share/vulkan/icd.d
echo "PYTHONPATH=$GITHUB_WORKSPACE/install/lib:$GITHUB_WORKSPACE/install/python:$GITHUB_WORKSPACE/tests" >> $GITHUB_ENV
if: runner.os == 'Linux'
- name: Set up test environment (Windows)
shell: pwsh
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/${env:VULKANSDK_VER}/windows/VulkanSDK-${env:VULKANSDK_VER}-Installer.exe -O VulkanSDK-Installer.exe
.\VulkanSDK-Installer.exe /S
Invoke-WebRequest -Uri https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-windows-2019-x86_64.zip -OutFile swiftshader.zip
Expand-Archive swiftshader.zip
Copy-Item swiftshader\lib\vk_swiftshader_icd.json swiftshader\bin\
echo "VK_ICD_FILENAMES=${env:GITHUB_WORKSPACE}/swiftshader/bin/vk_swiftshader_icd.json" >> $env:GITHUB_ENV
echo "PYTHONPATH=${env:GITHUB_WORKSPACE}/install/lib;${env:GITHUB_WORKSPACE}/install/python;${env:GITHUB_WORKSPACE}/tests" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install Python Packages
run: pip install -r requirements.test.txt
- name: Create Test Environment
run: mkdir test_results
- name: Install nncase
uses: actions/download-artifact@v3
with:
name: nncase-${{matrix.config.name}}
path: ${{github.workspace}}/install
- name: Generate benchmark kmodels
working-directory: ${{github.workspace}}/benchmark
env:
PATH: ${{github.workspace}}/install/bin
run: |
python gen_kmodel.py
if: matrix.config.name == 'x86_64-linux'
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update benchmark kmodels
file_pattern: 'benchmark/models/*'
if: matrix.config.name == 'x86_64-linux'
- name: Test
working-directory: ${{github.workspace}}
shell: bash
env:
PATH: ${{github.workspace}}/install/bin
run: |
pytest tests/other --doctest-modules --junitxml=test_results/other.xml
pytest tests/importer --doctest-modules --junitxml=test_results/importer.xml
pytest tests/schedule --doctest-modules --junitxml=test_results/schedule.xml
pytest tests/graph_partition --doctest-modules --junitxml=test_results/graph_partition.xml
pytest tests/examples --doctest-modules --junitxml=test_results/examples.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always() && matrix.config.name == 'x86_64-linux'
with:
files: test_results/*.xml