From 912e8125693a5f374f31f349fed370049fe53e69 Mon Sep 17 00:00:00 2001 From: Matej Kafka Date: Tue, 2 Apr 2024 01:55:37 +0200 Subject: [PATCH] CI: Add basic CI which builds Pog and runs Pog.Tests TODO: bootstrap 7zip and OpenedFilesView, test that Pog is able to install a package --- .github/workflows/build.yml | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fcb7d51 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,69 @@ +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: windows-latest + defaults: + run: + working-directory: app/Pog/lib_compiled + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Install ILRepack + shell: pwsh + run: | + iwr https://www.nuget.org/api/v2/package/ILRepack/2.0.29 -OutFile $env:TEMP\ilrepack.nupkg + Expand-Archive $env:TEMP\ilrepack.nupkg $env:TEMP\ilrepack + # add to PATH for following steps + Add-Content $env:GITHUB_PATH $env:TEMP\ilrepack\tools + + + - name: Remove private test projects + run: dotnet sln remove RandomTests RandomBenchmarks + + - name: Restore dependencies + run: dotnet restore + + - name: Publish + run: dotnet publish --no-restore Pog + + + - name: Setup PogNative CMake + run: cmake -B ./PogNative/cmake-build-release -S ./PogNative -DCMAKE_BUILD_TYPE=Release + + - name: Build PogNative + run: cmake --build ./PogNative/cmake-build-release --config Release + + + - name: Copy VC Redistributable + shell: pwsh + run: | + $SrcDir = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -find VC/Redist/MSVC/*/x64 + if ($null -eq $SrcDir) { + throw "Could not find VC Redistributable." + } + ls -Recurse -File $SrcDir | % {Write-Host $_; $_} | cp -Destination .\vc_redist\ + + + - name: Test + run: dotnet test --no-restore Pog.Tests + + - name: Import Pog + working-directory: . + shell: pwsh + run: Import-Module ./app/Pog -PassThru + + # TODO: either setup 7zip and OpenedFilesView and then run setup.ps1, + # or modify the bootstrap so that Pog can download both dependencies