-disable windows defender on windows CI server to fix functional tests #132
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: build & test (clang, gcc, MSVC) | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "master", "dev" ] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: [ "master", "dev" ] | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
env: | |
CC: ${{ matrix.config.cc }} | |
CXX: ${{ matrix.config.cxx }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Ubuntu Latest gcc", | |
os: ubuntu-latest, | |
cmake-preset: gcc-release, | |
cmake_vars: "", | |
asio_type: "standalone" | |
} | |
- { | |
name: "Ubuntu Latest clang", | |
os: ubuntu-latest, | |
cmake-preset: clang-release, | |
cmake_vars: "", | |
asio_type: "standalone" | |
} | |
- { | |
name: "Windows Latest MSVC", | |
os: windows-latest, | |
cmake-preset: msvc-release, | |
cmake_vars: "", | |
asio_type: "standalone" | |
} | |
- { | |
name: "Ubuntu Latest clang (Boost.Asio)", | |
os: ubuntu-latest, | |
cmake-preset: clang-release, | |
asio_type: "boost", | |
cmake_vars: "-DASYNCGI_USE_BOOST_ASIO=ON -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake", | |
} | |
- { | |
name: "Windows Latest MSVC (Boost.Asio)", | |
os: windows-latest, | |
cmake-preset: msvc-release, | |
asio_type: "boost", | |
cmake_vars: "-DASYNCGI_USE_BOOST_ASIO=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DCMAKE_TOOLCHAIN_FILE='vcpkg/scripts/buildsystems/vcpkg.cmake'" | |
} | |
steps: | |
- name: Install ninja (Windows) | |
if: matrix.config.os == 'windows-latest' | |
run: choco install ninja | |
- name: Install ninja (Linux) | |
if: matrix.config.os == 'ubuntu-latest' | |
run: sudo apt install ninja-build | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
- uses: hendrikmuhs/ccache-action@v1.2 | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Install vcpkg | |
uses: lukka/run-vcpkg@v10 | |
with: | |
vcpkgGitCommitId: 31a159c1cae2bf905299085d9ef01bdfea0ca7b8 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DENABLE_EXAMPLES=ON ${{ matrix.config.cmake_vars }} --preset="${{ matrix.config.cmake-preset }}" | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config Release | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: asyncgi-examples-${{ matrix.config.os }}-${{ matrix.config.asio_type }}-asio | |
path: build/examples/ | |
- name: Upload build test artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: asyncgi-test-examples-${{ matrix.config.os }}-${{ matrix.config.asio_type }}-asio | |
path: build/test_examples/ | |
functional_tests: | |
name: Functional testing (${{ matrix.config.name }} ${{ matrix.asio_type }}-asio) | |
needs: build | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
asio_type: [ "standalone", "boost" ] | |
config: | |
- { | |
name: "Windows", | |
os: "windows-latest", | |
lunchtoast_exec: "lunchtoast.exe", | |
shell_command: -shell="msys2 -c", | |
tags: -skip=linux, | |
nginx_exec: "c:/tools/nginx-1.27.0/nginx.exe", | |
nginx_cfg: "nginx_windows.conf" | |
} | |
- { | |
name: "Linux", | |
os: "ubuntu-latest", | |
lunchtoast_exec: "lunchtoast", | |
shell_command: "", | |
tags: "", | |
nginx_exec: "nginx", | |
nginx_cfg: "nginx_linux.conf" | |
} | |
steps: | |
- if: matrix.config.name == 'Windows' | |
name: Disable Windows Defender real monitoring | |
run: Set-MpPreference -DisableRealtimeMonitoring $true | |
shell: powershell | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- if: matrix.config.name == 'Windows' | |
name: Install MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
path-type: inherit | |
- name: Download lunchtoast | |
uses: robinraju/release-downloader@v1.7 | |
with: | |
repository: "kamchatka-volcano/lunchtoast" | |
latest: true | |
filename: ${{ matrix.config.lunchtoast_exec }} | |
out-file-path: "lunchtoast/" | |
- name: Set lunchtoast execute permissions | |
if: matrix.config.name == 'Linux' | |
shell: sh | |
working-directory: ${{github.workspace}}/lunchtoast | |
run: chmod +x lunchtoast | |
- name: Download asyncgi examples build | |
uses: actions/download-artifact@v3 | |
with: | |
name: asyncgi-examples-${{ matrix.config.os }}-${{ matrix.asio_type }}-asio | |
path: build/examples | |
- name: Download asyncgi test_examples build | |
id: pre_launch_tests | |
uses: actions/download-artifact@v3 | |
with: | |
name: asyncgi-test-examples-${{ matrix.config.os }}-${{ matrix.asio_type }}-asio | |
path: build/test_examples | |
- name: Set artifacts execute permissions | |
if: matrix.config.name == 'Linux' | |
shell: sh | |
working-directory: ${{github.workspace}}/build/ | |
run: chmod +x examples/example_* && chmod +x test_examples/test_* | |
- name: Make temp dir for NGINX | |
run: mkdir ${{github.workspace}}/temp | |
- name: Launch tests | |
uses: BerniWittmann/background-server-action@v1 | |
with: | |
command: lunchtoast/lunchtoast functional_tests ${{ matrix.config.shell_command }} ${{ matrix.config.tags }} -collectFailedTests=failed_tests | |
start: ${{ matrix.config.nginx_exec }} -c '${{github.workspace}}'/functional_tests/${{ matrix.config.nginx_cfg }} | |
- name: Upload failed tests | |
if: failure() && steps.launch_tests.outcome != 'success' && steps.pre_launch_tests.outcome == 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: asyncgi-failed-tests-${{ matrix.config.os }} | |
path: failed_tests |