Skip to content

Commit

Permalink
Tentative update github action.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jul 4, 2024
1 parent d631504 commit de715bd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 57 deletions.
69 changes: 29 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Build USVFS

on:
push:
branches: master
branches: [master, dev/cmake]
pull_request:
types: [opened, synchronize, reopened]

env:
BOOST_PREBUILT_URL: "https://github.com/ModOrganizer2/mob/releases/download/2.5-dependencies/boost_prebuilt_1_85_0.7z"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

jobs:
build:
Expand All @@ -16,57 +16,46 @@ jobs:
matrix:
arch: [x86, x64]
config: [Debug, Release]
tests: ["", "Test"]
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch Boost prebuilt
run: |
Invoke-WebRequest -Uri ${env:BOOST_PREBUILT_URL} -OutFile boost.7z
Expand-7ZipArchive -Path boost.7z -Destination .\boost
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
# https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
msbuild-architecture: ${{ matrix.arch }}
- if: matrix.tests == 'Test'
name: Fetch googletest
uses: actions/checkout@v4
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# checkout USVFS and vcpkg
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: google/googletest
path: ./googletest
- if: matrix.tests == 'Test'
name: Build googletest
run: |
cmake -B googletest/build_${{ matrix.arch }} `
-A ${{ matrix.arch == 'x86' && 'Win32' || 'x64' }} `
-Dgtest_force_shared_crt=ON `
googletest
cmake --build googletest/build_${{ matrix.arch }} --config ${{ matrix.config }}
- name: Build
run: |
msbuild -nologo `
-maxCpuCount "-property:UseMultiToolTask=true" "-property:EnforceProcessCountAcrossBuilds=true" `
"-property:Configuration=${{ matrix.config }}${{ matrix.tests }}" `
"-property:Platform=${{ matrix.arch }}" `
"-property:BOOST_PATH=..\boost" `
"-property:GTEST_PATH=..\googletest" `
"-property:GTEST_LIBDIR=..\googletest\build_${{ matrix.arch }}\lib\${{ matrix.config }}" `
"-property:RunCodeAnalysis=false" `
.\vsbuild\usvfs.sln
repository: microsoft/vcpkg
path: ${{ github.workspace }}/vcpkg
- name: bootstrap-vcpkg-win
run: bootstrap-vcpkg.bat
working-directory: ${{ github.workspace }}\vcpkg
shell: cmd

# configure
- run: cmake --preset vs2022-windows-${{ matrix.arch }} -B build_${{ matrix.arch }}
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

# build
- run: cmake --build build_${{ matrix.arch }} --config ${{ matrix.config }}

- if: matrix.tests == 'Test' && matrix.config == 'Debug'
- if: matrix.config == 'Debug'
uses: actions/upload-artifact@master
with:
name: usvfs-libs_${{ matrix.arch }}
path: ./lib
- if: matrix.tests == 'Test' && matrix.config == 'Debug'
- if: matrix.config == 'Debug'
uses: actions/upload-artifact@master
with:
name: usvfs-bins_${{ matrix.arch }}
path: ./bin
- if: matrix.tests == 'Test' && matrix.config == 'Debug'
- if: matrix.config == 'Debug'
uses: actions/upload-artifact@master
with:
name: usvfs-tests_${{ matrix.arch }}
Expand Down
23 changes: 6 additions & 17 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@
}
},
"hidden": true,
"inherits": [
"vcpkg"
],
"inherits": ["vcpkg"],
"name": "vcpkg-dev"
},
{
"binaryDir": "${sourceDir}/cbuild64",
"binaryDir": "${sourceDir}/vsbuild64",
"architecture": {
"strategy": "set",
"value": "x64"
Expand All @@ -61,7 +59,7 @@
"name": "windows-x64"
},
{
"binaryDir": "${sourceDir}/cbuild32",
"binaryDir": "${sourceDir}/vsbuild32",
"architecture": {
"strategy": "set",
"value": "Win32"
Expand All @@ -80,26 +78,17 @@
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4"
},
"generator": "Visual Studio 17 2022",
"inherits": [
"cmake-dev",
"vcpkg-dev"
],
"inherits": ["cmake-dev", "vcpkg-dev"],
"hidden": true,
"name": "vs2022-windows",
"toolset": "v143"
},
{
"inherits": [
"vs2022-windows",
"windows-x64"
],
"inherits": ["vs2022-windows", "windows-x64"],
"name": "vs2022-windows-x64"
},
{
"inherits": [
"vs2022-windows",
"windows-x86"
],
"inherits": ["vs2022-windows", "windows-x86"],
"name": "vs2022-windows-x86"
}
],
Expand Down

0 comments on commit de715bd

Please sign in to comment.