Skip to content

Update buildcache.cmake #347

Update buildcache.cmake

Update buildcache.cmake #347

Workflow file for this run

name: windows build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
windows-build:
runs-on: [ self-hosted, windows, x64 ]
strategy:
fail-fast: false
matrix:
config:
- preset: msvc-release
artifact: windows-amd64
- preset: msvc-cista-release
env:
BUILDCACHE_DIR: ${{ github.workspace }}/.buildcache
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_MAX_CACHE_SIZE: 26843545600
steps:
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master
- name: get locally cached deps
run: |
$depsHash = "${{ hashFiles('.pkg') }}".Substring(0, 8)
$depsPath = "${{ runner.tool_cache }}\${{ github.event.repository.name }}\deps-$depsHash"
New-Item -ItemType Directory -Force -Path $depsPath
New-Item -Path .\deps\ -ItemType SymbolicLink -Value $depsPath
- name: get locally cached buildcache
run: |
$buildcacheHash = "${{ hashFiles('.pkg', '**/*.h', '**/*.cc') }}".Substring(0, 8)
$buildcachePath = "${{ runner.tool_cache }}\${{ github.event.repository.name }}\buildcache-${{ matrix.config.preset }}-$buildcacheHash"
New-Item -ItemType Directory -Force -Path $buildcachePath
New-Item -Path .\.buildcache\ -ItemType SymbolicLink -Value $buildcachePath
# ==== BUILD ====
- name: Build
run: |
$devShell = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find **\Microsoft.VisualStudio.DevShell.dll
$installPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationpath
Import-Module $devShell
Enter-VsDevShell -VsInstallPath $installPath -SkipAutomaticLocation -DevCmdArguments "-arch=amd64"
cmake --preset=${{ matrix.config.preset }}
cmake --build build\${{ matrix.config.preset }} --target soro-client
cmake --build build\${{ matrix.config.preset }} --target soro-server
cmake --build build\${{ matrix.config.preset }} --target soro-test
- name: Install Webclient
run: npm clean-install --prefix web/client
# ==== TESTS ====
- name: Run Tests
run: .\build\${{ matrix.config.preset }}\soro-test.exe
# ==== WEB TESTS ====
- name: Run Webclient Tests
run: npm run test --prefix web/client
- name: Run Server
run: |
cd build\${{ matrix.config.preset }}\
.\soro-server.exe -t --resource_dir ..\..\resources
# ==== DISTRIBUTION ====
- name: Delete unnecessary files
if: matrix.config.artifact
run: |
rm .\build\${{ matrix.config.preset }}\server_resources\infrastructure -r -force
rm .\build\${{ matrix.config.preset }}\server_resources\timetable -r -force
- name: Create Distribution
if: matrix.config.artifact
run: >
7z a soro-s-${{ matrix.config.artifact }}.zip
.\build\${{ matrix.config.preset }}\soro-server.exe
.\build\${{ matrix.config.preset }}\server_resources
- name: Upload Distribution
if: matrix.config.artifact
uses: actions/upload-artifact@v1
with:
name: soro-s-${{ matrix.config.artifact }}
path: soro-s-${{ matrix.config.artifact }}.zip
# ==== RELEASE ====
- name: Upload Release
if: github.event.action == 'published' && matrix.config.artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./soro-s-${{ matrix.config.artifact }}.zip
asset_name: soro-s-${{ matrix.config.artifact }}.zip
asset_content_type: application/zip