From a86ded97c97e75cacef636071283be0392061113 Mon Sep 17 00:00:00 2001 From: Kritik Bhimani Date: Sat, 24 Dec 2022 04:42:17 +0530 Subject: [PATCH] CI: Add ci for cmake on windows (#2681) (#3819) --- .github/workflows/msbuild.yml | 51 +++++++++++++++++++++++++++++++++++ ci/ci-win-compile.ps1 | 15 +++++++++++ ci/ci-win-test.ps1 | 10 +++++++ 3 files changed, 76 insertions(+) create mode 100644 .github/workflows/msbuild.yml create mode 100644 ci/ci-win-compile.ps1 create mode 100644 ci/ci-win-test.ps1 diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml new file mode 100644 index 000000000..dd25c2669 --- /dev/null +++ b/.github/workflows/msbuild.yml @@ -0,0 +1,51 @@ +# DESCRIPTION: Github actions config +# This name is key to badges in README.rst, so we use the name build +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +name: msbuild + +on: + push: + pull_request: + workflow_dispatch: + schedule: + - cron: '0 0 * * 0' # weekly + +env: + CI_OS_NAME: win + CI_COMMIT: ${{ github.sha }} + CCACHE_COMPRESS: 1 + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_LIMIT_MULTIPLE: 0.95 + +defaults: + run: + working-directory: repo + +jobs: + + windows: + name: run on windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + path: repo + - name: Cache $CCACHE_DIR + uses: actions/cache@v3 + with: + path: ${{ env.CCACHE_DIR }} + key: msbuild-msvc-cmake + - name: compile + env: + WIN_FLEX_BISON: ${{ github.workspace }}/.ccache + run: ./ci/ci-win-compile.ps1 + - name: test build + run: ./ci/ci-win-test.ps1 + - name: Zip up repository + run: Compress-Archive -LiteralPath install -DestinationPath verilator.zip + - name: Upload zip archive + uses: actions/upload-artifact@v3 + with: + path: ${{ github.workspace }}/repo/verilator.zip + name: verilator-win.zip diff --git a/ci/ci-win-compile.ps1 b/ci/ci-win-compile.ps1 new file mode 100644 index 000000000..20a744539 --- /dev/null +++ b/ci/ci-win-compile.ps1 @@ -0,0 +1,15 @@ +if (-Not (Test-Path $PWD/../.ccache/win_bison.exe)) { + git clone --depth 1 https://github.com/lexxmark/winflexbison + cd winflexbison + mkdir build + cd build + cmake .. --install-prefix $PWD/../../../.ccache + cmake --build . --config Release + cmake --install . --prefix $PWD/../../../.ccache + cd ../.. +} +mkdir build +cd build +cmake .. --install-prefix $PWD/../install +cmake --build . --config Release +cmake --install . --prefix $PWD/../install diff --git a/ci/ci-win-test.ps1 b/ci/ci-win-test.ps1 new file mode 100644 index 000000000..1900bd4a5 --- /dev/null +++ b/ci/ci-win-test.ps1 @@ -0,0 +1,10 @@ +cd install +$Env:VERILATOR_ROOT=$PWD +cd examples/cmake_tracing_c +mkdir build +cd build +cmake .. +cmake --build . --config Release +Release/example.exe +cd .. +Remove-Item -path build -recurse