libevent/.github/workflows/windows.yml
Azat Khuzhin aba6548c53 Switch to lukka/run-vcpkg@v7 and update vcpkgGitCommitId
Let's see if it uses set-env or not [1]:

    Run lukka/run-vcpkg@v2
    Restore vcpkg and its artifacts from cache
    Set output env vars
      Error: Unable to process command '::set-env name=RUNVCPKG_VCPKG_ROOT::D:\a\libevent\vcpkg' successfully.
      Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

  [1]: https://github.com/libevent/libevent/runs/2172680596?check_suite_focus=true#step:4:24

And this one [2]:

    error: could not open file /var/cache/pacman/pkg/libzstd-1.5.0-1-x86_64.pkg.tar.zst: Child process exited with status 127
    error: could not open file /var/cache/pacman/pkg/zstd-1.5.0-1-x86_64.pkg.tar.zst: Child process exited with status 127
    error: could not open file /var/cache/pacman/pkg/pacman-5.2.2-23-x86_64.pkg.tar.zst: Child process exited with status 127
    error: failed to commit transaction (cannot open package file)

  [2]: https://github.com/libevent/libevent/pull/1168/checks?check_run_id=2706159518#step:4:367
2021-05-31 10:36:08 +03:00

247 lines
7.9 KiB
YAML

---
name: windows
on:
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**.md'
- '.mailmap'
- 'ChangeLog*'
- 'whatsnew*'
- 'LICENSE'
push:
paths-ignore:
- '**.md'
- '.mailmap'
- 'ChangeLog*'
- 'whatsnew*'
- 'LICENSE'
jobs:
vs2017:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
os: [windows-2016]
EVENT_MATRIX: [NONE]
steps:
- uses: actions/checkout@v2.0.0
- name: Cache Build
uses: actions/cache@v2
with:
path: build
key: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-v4
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v7
id: runvcpkg
with:
vcpkgArguments: zlib:x64-windows openssl:x64-windows mbedtls:x64-windows
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x64-windows
vcpkgGitCommitId: 7bc5b8cdfaf35329c1520b2af8d368e2b1cb78e6
- name: Build And Test
shell: powershell
run: |
$EVENT_BUILD_PARALLEL=10
$EVENT_TESTS_PARALLEL=1
mkdir build -ea 0
cd build
$CMAKE_CMD="cmake -G 'Visual Studio 15 2017 Win64' -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake .."
function cmake_configure($retry)
{
$errcode=0
try {
if ($retry -eq 0) {
echo "[cmake configure retry] $CMAKE_CMD"
} else {
echo "[cmake configure] $CMAKE_CMD"
}
Invoke-Expression $CMAKE_CMD
$errcode=$LastExitCode
}
catch {
$errcode=1
}
finally {
if ($errcode -ne 0) {
if ($retry -eq 0) {
$host.SetShouldExit($LastExitCode)
} else {
echo "Remove all entries in build directory"
rm -r -fo *
cmake_configure 0
}
}
}
}
cmake_configure 1
try {
cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
if ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC") {
python ../test-export/test-export.py static
}
elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") {
python ../test-export/test-export.py shared
}
else {
ctest --output-on-failure -j $EVENT_TESTS_PARALLEL
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
} catch {
$host.SetShouldExit($LastExitCode)
}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-build
path: build
vs2019:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
os: [windows-2019]
EVENT_MATRIX:
- NONE
- NO_SSL
- LIBRARY_TYPE_STATIC
- DISABLE_OPENSSL
- DISABLE_THREAD_SUPPORT
- DISABLE_DEBUG_MODE
- DISABLE_MM_REPLACEMENT
- DUNICODE
- TEST_EXPORT_SHARED
- TEST_EXPORT_STATIC
steps:
- uses: actions/checkout@v2.0.0
- name: Cache Build
uses: actions/cache@v2
with:
path: build
key: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-v4
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v7
id: runvcpkg
with:
vcpkgArguments: zlib:x64-windows openssl:x64-windows mbedtls:x64-windows
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x64-windows
vcpkgGitCommitId: 7bc5b8cdfaf35329c1520b2af8d368e2b1cb78e6
- name: Build And Test
shell: powershell
run: |
$EVENT_BUILD_PARALLEL=10
$EVENT_TESTS_PARALLEL=1
if ( "${{ matrix.EVENT_MATRIX }}" -eq "LIBRARY_TYPE_STATIC" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__MSVC_STATIC_RUNTIME=OFF"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_OPENSSL" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_THREAD_SUPPORT" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_THREAD_SUPPORT=ON"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_DEBUG_MODE" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_DEBUG_MODE=ON"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_MM_REPLACEMENT" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_MM_REPLACEMENT=ON"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "UNICODE" ) {
$EVENT_CMAKE_OPTIONS="-DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__MSVC_STATIC_RUNTIME=OFF -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON"
}
elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "NO_SSL" ) {
$EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON -DEVENT__DISABLE_MBEDTLS=ON"
}
else {
$EVENT_CMAKE_OPTIONS=""
}
mkdir build -ea 0
cd build
if ("${{ matrix.os }}" -eq "windows-2016") {
$CMAKE_CMD="cmake -G 'Visual Studio 15 2017 Win64' -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake .."
}
else { # windows-2019
$CMAKE_CMD="cmake -G 'Visual Studio 16 2019' -A x64 -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake .. $EVENT_CMAKE_OPTIONS"
}
function cmake_configure($retry)
{
$errcode=0
try {
if ($retry -eq 0) {
echo "[cmake configure retry] $CMAKE_CMD"
} else {
echo "[cmake configure] $CMAKE_CMD"
}
Invoke-Expression $CMAKE_CMD
$errcode=$LastExitCode
}
catch {
$errcode=1
}
finally {
if ($errcode -ne 0) {
if ($retry -eq 0) {
$host.SetShouldExit($LastExitCode)
} else {
echo "Remove all entries in build directory"
rm -r -fo *
cmake_configure 0
}
}
}
}
cmake_configure 1
try {
cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
if ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC") {
python ../test-export/test-export.py static
}
elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") {
python ../test-export/test-export.py shared
}
else {
ctest --output-on-failure -j $EVENT_TESTS_PARALLEL
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
} catch {
$host.SetShouldExit($LastExitCode)
}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-build
path: build