CI use local vcpkg instead of cloning #260
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows Builds | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
- 'LICENSE' | |
- 'Assets/**' | |
- 'Docs/**' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
- 'LICENSE' | |
- 'Assets/**' | |
- 'Docs/**' | |
workflow_dispatch: | |
env: | |
PLATFORM_NAME: Win32 | |
BUILD_TYPE: RelWithDebInfo | |
UPLOAD_ARTIFACT: true | |
CACHE_DEPS: false | |
FIXED_CMAKE_VERSION: | |
jobs: | |
Build: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Prepare build directory | |
run: mkdir Build | |
- name: Generate dependencies cache key | |
if: env.CACHE_DEPS == 'true' | |
run: | | |
curl -o Build/DepsRef.json https://api.github.com/repos/SpriteOvO/AirPodsDesktop-Deps/git/refs/heads/main | |
cat DepsRef.json | |
- name: Dependencies cache | |
id: cache-deps | |
if: env.CACHE_DEPS == 'true' | |
uses: actions/cache@v2 | |
with: | |
path: Build/AirPodsDesktop-Deps | |
key: ${{ hashFiles('Build/DepsRef.json') }} | |
- name: Clone dependencies | |
if: env.CACHE_DEPS != 'true' || steps.cache-deps.outputs.cache-hit != 'true' | |
working-directory: Build | |
run: | | |
git clone --recursive https://github.com/SpriteOvO/AirPodsDesktop-Deps.git | |
- name: Print CMake version | |
run: cmake --version | |
- name: Use a fixed version of CMake | |
if: env.FIXED_CMAKE_VERSION != '' | |
run: | | |
choco install cmake.install --version ${{ env.FIXED_CMAKE_VERSION }} --installargs 'ADD_CMAKE_TO_PATH=System' --force | |
cmake --version | |
- name: Generate project and build | |
working-directory: Build | |
run: | | |
mkdir ${{ env.BUILD_TYPE }} && cd ${{ env.BUILD_TYPE }} | |
cmake -G "Visual Studio 17 2022" \ | |
-A ${{ env.PLATFORM_NAME }} \ | |
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \ | |
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/Build/AirPodsDesktop-Deps/Qt/5.15.2/msvc2019" \ | |
-DAPD_GENERATE_INSTALLER=ON \ | |
-DAPD_BUILD_GIT_HASH=${{ github.sha }} \ | |
../../ | |
cmake --build . \ | |
--config ${{ env.BUILD_TYPE }} | |
- name: List built files | |
working-directory: Build | |
shell: pwsh | |
run: | | |
tree /F /A Binary | |
tree /F /A Installer | |
- name: Prepare artifacts | |
if: env.UPLOAD_ARTIFACT == 'true' | |
working-directory: Build/${{ env.BUILD_TYPE }}/Installer | |
run: | | |
cd _CPack_Packages/win32/NSIS | |
mv AirPodsDesktop-*-win32 AirPodsDesktop-${{ github.sha }}-win32 | |
- name: Upload artifact - Installer | |
uses: actions/upload-artifact@v2 | |
if: env.UPLOAD_ARTIFACT == 'true' | |
with: | |
name: AirPodsDesktop-${{ github.sha }}-Installer | |
path: Build/${{ env.BUILD_TYPE }}/Installer/AirPodsDesktop-*-win32.exe | |
retention-days: 90 | |
- name: Upload artifact - Portable | |
uses: actions/upload-artifact@v2 | |
if: env.UPLOAD_ARTIFACT == 'true' | |
with: | |
name: AirPodsDesktop-${{ github.sha }}-Portable | |
path: Build/${{ env.BUILD_TYPE }}/Installer/_CPack_Packages/win32/NSIS/AirPodsDesktop-${{ github.sha }}-win32/AirPodsDesktop | |
retention-days: 90 |