Update README.md (#15) #36
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: CI | |
on: | |
push: | |
branches: [main, v1.0.*] | |
pull_request: | |
branches: [main, v1.0.*] | |
jobs: | |
ubuntu-build: | |
runs-on: ubuntu-latest | |
env: | |
# set_option known to fail on Github Actions | |
COMMON_CTEST_ARGS: ---no-compress-output --output-on-failure -E "^set_option$" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: src | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install libudev-dev ninja-build | |
- name: Configure | |
run: | | |
rm -rf build install | |
cmake -B build/shared -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON | |
cmake -B build/static -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF | |
- name: Build Shared | |
working-directory: build/shared | |
run: ninja install | |
- name: Build Static | |
working-directory: build/static | |
run: ninja install | |
- name: Check artifacts | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "install/shared/lib/libusb-1.0.so, \ | |
install/shared/include/libusb-1.0/libusb.h, \ | |
install/static/lib/libusb-1.0.a, \ | |
install/shared/include/libusb-1.0/libusb.h" | |
fail: true | |
- name: Test Shared | |
if: always() | |
working-directory: build/shared | |
run: ctest --output-junit test_shared.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Test Static | |
if: always() | |
working-directory: build/static | |
run: ctest --output-junit test_static.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results Ubuntu | |
path: | | |
build/shared/test_shared.xml | |
build/static/test_static.xml | |
macos-buid: | |
runs-on: macos-latest | |
env: | |
COMMON_CTEST_ARGS: --no-compress-output --output-on-failure | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: src | |
- name: Install dependencies | |
run: brew install ninja | |
- name: Configure | |
run: | | |
rm -rf build install | |
cmake -B build/shared -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON | |
cmake -B build/static -S src -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF | |
- name: Build Shared | |
working-directory: build/shared | |
run: ninja install | |
- name: Build Static | |
working-directory: build/static | |
run: ninja install | |
- name: Check artifacts | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "install/shared/lib/libusb-1.0.dylib, \ | |
install/shared/include/libusb-1.0/libusb.h, \ | |
install/static/lib/libusb-1.0.a, \ | |
install/shared/include/libusb-1.0/libusb.h" | |
fail: true | |
- name: Test Shared | |
if: always() | |
working-directory: build/shared | |
run: ctest --output-junit test_shared.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Test Static | |
if: always() | |
working-directory: build/static | |
run: ctest --output-junit test_static.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results macOS | |
path: | | |
build/shared/test_shared.xml | |
build/static/test_static.xml | |
windows-msvc-buid: | |
runs-on: windows-latest | |
env: | |
COMMON_CTEST_ARGS: --no-compress-output --output-on-failure | |
VCVARS64_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: src | |
- name: Install dependencies | |
run: choco install ninja | |
- name: Configure Visual Studio | |
run: | | |
cmake -B build/msvc -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/msvc -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON | |
- name: Configure NMake/Ninja | |
shell: cmd | |
run: | | |
call "${{ env.VCVARS64_PATH }}" | |
cmake -G"NMake Makefiles" -B build\nmake_shared -DCMAKE_INSTALL_PREFIX=install/nmake_shared -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON | |
cmake -G"NMake Makefiles" -B build\nmake_static -DCMAKE_INSTALL_PREFIX=install/nmake_static -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF | |
cmake -GNinja -B build\ninja_shared -DCMAKE_INSTALL_PREFIX=install/ninja_shared -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=ON | |
cmake -GNinja -B build\ninja_static -DCMAKE_INSTALL_PREFIX=install/ninja_static -S src -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBUSB_BUILD_EXAMPLES=ON -DLIBUSB_BUILD_TESTING=ON -DLIBUSB_BUILD_SHARED_LIBS=OFF | |
- name: Build Visual Studio | |
working-directory: build/msvc | |
run: cmake --build . --config RelWithDebInfo --target install | |
- name: Build NMake Shared | |
working-directory: build/nmake_shared | |
shell: cmd | |
run: | | |
call "${{ env.VCVARS64_PATH }}" | |
nmake install | |
- name: Build NMake Static | |
working-directory: build/nmake_static | |
shell: cmd | |
run: | | |
call "${{ env.VCVARS64_PATH }}" | |
nmake install | |
- name: Build Ninja Shared | |
working-directory: build/ninja_shared | |
shell: cmd | |
run: | | |
call "${{ env.VCVARS64_PATH }}" | |
ninja install | |
- name: Build Ninja Static | |
working-directory: build/ninja_static | |
shell: cmd | |
run: | | |
call "${{ env.VCVARS64_PATH }}" | |
ninja install | |
- name: Check artifacts | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "install/msvc/lib/usb-1.0.lib, \ | |
install/msvc/bin/libusb-1.0.dll, \ | |
install/msvc/include/libusb-1.0/libusb.h, \ | |
install/nmake_shared/lib/usb-1.0.lib, \ | |
install/nmake_shared/bin/libusb-1.0.dll, \ | |
install/nmake_shared/include/libusb-1.0/libusb.h, \ | |
install/nmake_static/lib/libusb-1.0.lib, \ | |
install/nmake_static/include/libusb-1.0/libusb.h, \ | |
install/ninja_shared/lib/usb-1.0.lib, \ | |
install/ninja_shared/bin/libusb-1.0.dll, \ | |
install/ninja_shared/include/libusb-1.0/libusb.h, \ | |
install/ninja_static/lib/libusb-1.0.lib, \ | |
install/ninja_static/include/libusb-1.0/libusb.h" | |
fail: true | |
- name: Test Visual Studio | |
if: always() | |
working-directory: build/msvc | |
shell: cmd | |
run: | | |
set PATH=%PATH%;${{ github.workspace }}\install\msvc\bin | |
ctest -C RelWithDebInfo --output-junit test_msvc.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Test NMake Shared | |
if: always() | |
working-directory: build/nmake_shared | |
shell: cmd | |
run: | | |
set PATH=%PATH%;${{ github.workspace }}\install\nmake_shared\bin | |
ctest --output-junit test_nmake_shared.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Test NMake Static | |
if: always() | |
working-directory: build/nmake_static | |
run: ctest --output-junit test_nmake_static.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Test Ninja Shared | |
if: always() | |
working-directory: build/ninja_shared | |
shell: cmd | |
run: | | |
set PATH=%PATH%;${{ github.workspace }}\install\ninja_shared\bin | |
ctest --output-junit test_ninja_shared.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Test Ninja Static | |
if: always() | |
working-directory: build/ninja_static | |
run: ctest --output-junit test_ninja_static.xml ${{ env.COMMON_CTEST_ARGS }} | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results MSVC | |
path: | | |
build/msvc/test_msvc.xml | |
build/nmake_shared/test_nmake_shared.xml | |
build/nmake_static/test_nmake_static.xml | |
build/ninja_shared/test_ninja_shared.xml | |
build/ninja_static/test_ninja_static.xml | |
publish-test-results: | |
name: "Publish Tests Results" | |
needs: [ubuntu-build, macos-buid, windows-msvc-buid] | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
if: always() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "artifacts/**/*.xml" |