diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 41dbaf86..4089db0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,54 +15,143 @@ on: jobs: windows: - name: 'Windows 32/64 Bit' + name: 'Windows 32+64bit' runs-on: [windows-latest] if: contains(github.event.head_commit.message, '[skip ci]') != true env: - build_config: 'RelWithDebInfo' - DEPS_CACHE_VERSION: '3' # Change whenever updating OBS dependencies URL, in order to force a cache reset - DEPS_BASE_PATH: 'D:\obsdependencies' - DEPS_PATH_32: 'D:\obsdependencies\win32' - DEPS_PATH_64: 'D:\obsdependencies\win64' - QT_CACHE_VERSION: '4' # Change whenever updating Qt dependency URL, in order to force a cache reset - QT_BASE_DIR: 'D:\QtDep' - QTDIR32: 'D:\QtDep\5.15.2\msvc2019' - QTDIR64: 'D:\QtDep\5.15.2\msvc2019_64' - OBS_PATH: 'D:\obs-studio' + QT_VERSION: '5.15.2' + WINDOWS_DEPS_VERSION: '2019' + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_SYSTEM_VERSION: "10.0" steps: + - name: 'Add msbuild to PATH' + uses: microsoft/setup-msbuild@v1.0.2 - name: 'Checkout' uses: actions/checkout@v2 with: + path: ${{ github.workspace }}/obs-websocket submodules: 'recursive' - - name: 'Restore cached Qt archive file' - id: qtcache - uses: actions/cache@v2 + - name: 'Checkout OBS' + uses: actions/checkout@v2 with: - path: ${{ env.QT_BASE_DIR }}\** - key: 'qtdep-${{ env.QT_CACHE_VERSION }} | ${{ runner.os }}' - restore-keys: | - qtdep-${{ env.QT_CACHE_VERSION }} | ${{ runner.os }} - - name: 'Download and Extract Qt' - if: steps.qtcache.outputs.cache-hit != 'true' + repository: obsproject/obs-studio + path: ${{ github.workspace }}/obs-studio + submodules: 'recursive' + - name: 'Get OBS-Studio git info' + shell: bash + working-directory: ${{ github.workspace }}/obs-studio run: | - mkdir ${{ env.QT_BASE_DIR }} - cd D:\ - curl -kLO https://tt2468.net/dl/Qt_5.15.2.7z -f --retry 5 -C - - 7z x Qt_5.15.2.7z -o${{ env.QT_BASE_DIR }} - dir ${{ env.QT_BASE_DIR }} - - name: 'Restore cached OBS Studio dependencies' - id: obscache + git fetch --prune --unshallow + echo ::set-env name=OBS_GIT_BRANCH::$(git rev-parse --abbrev-ref HEAD) + echo ::set-env name=OBS_GIT_HASH::$(git rev-parse --short HEAD) + echo ::set-env name=OBS_GIT_TAG::$(git describe --tags --abbrev=0) + - name: 'Checkout last OBS-Studio release (${{ env.OBS_GIT_TAG }})' + shell: bash + working-directory: ${{ github.workspace }}/obs-studio + run: | + git checkout ${{ env.OBS_GIT_TAG }} + git submodule update + - name: 'Get obs-websocket git info' + shell: bash + working-directory: ${{ github.workspace }}/obs-websocket + run: | + git fetch --prune --unshallow + echo ::set-env name=GIT_BRANCH::${{ github.event.pull_request.head.ref }} + echo ::set-env name=GIT_HASH::$(git rev-parse --short HEAD) + echo ::set-env name=GIT_TAG::$(git describe --tags --abbrev=0) + - name: 'Install prerequisite: QT' + run: | + curl -kLO https://tt2468.net/dl/Qt_${{ env.QT_VERSION }}.7z -f --retry 5 -C - + 7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}\cmbuild\QT" + - name: 'Install prerequisite: Pre-built OBS dependencies' + run: | + curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -f --retry 5 -C - + 7z x dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -o"${{ github.workspace }}\cmbuild\deps" + - name: 'Restore OBS 32-bit build v${{ env.OBS_GIT_TAG }} from cache' + id: build-cache-obs-32 uses: actions/cache@v2 + env: + CACHE_NAME: 'build-cache-obs-32' with: - path: ${{ env.DEPS_BASE_PATH }}\** - key: 'obsdep-${{ env.DEPS_CACHE_VERSION }} | ${{ runner.os }}' + path: ${{ github.workspace }}/obs-studio/build32 + key: ${{ runner.os }}-${{ env.CACHE_NAME }}-${{ env.OBS_GIT_TAG }} restore-keys: | - obsdep-${{ env.DEPS_CACHE_VERSION }} | ${{ runner.os }} - - name: 'Download and Extract deps' - if: steps.obscache.outputs.cache-hit != 'true' + ${{ runner.os }}-${{ env.CACHE_NAME }}- + - name: 'Configure OBS 32-bit' + if: steps.build-cache-obs-32.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio run: | - mkdir ${{ env.DEPS_BASE_PATH }} - cd D:\ - curl -o dependencies.zip -kLO https://cdn-fastly.obsproject.com/downloads/dependencies2019.zip -f --retry 5 -C - - 7z x dependencies.zip -o${{ env.DEPS_BASE_PATH }} - dir ${{ env.DEPS_BASE_PATH }} \ No newline at end of file + mkdir .\build32 + cd .\build32 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A Win32 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017" -DDepsPath="${{ github.workspace }}\cmbuild\deps\win32" -DCOPIED_DEPENDENCIES=NO -DCOPY_DEPENDENCIES=YES .. + - name: 'Build OBS-Studio 32-bit' + if: steps.build-cache-obs-32.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio + run: | + msbuild /m /p:Configuration=RelWithDebInfo .\build32\libobs\libobs.vcxproj + msbuild /m /p:Configuration=RelWithDebInfo .\build32\UI\obs-frontend-api\obs-frontend-api.vcxproj + - name: 'Restore OBS 64-bit build v${{ env.OBS_GIT_TAG }} from cache' + id: build-cache-obs-64 + uses: actions/cache@v1 + env: + CACHE_NAME: 'build-cache-obs-64' + with: + path: ${{ github.workspace }}/obs-studio/build64 + key: ${{ runner.os }}-${{ env.CACHE_NAME }}-${{ env.OBS_GIT_TAG }} + restore-keys: | + ${{ runner.os }}-${{ env.CACHE_NAME }}- + - name: 'Configure OBS 64-bit' + if: steps.build-cache-obs-64.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio + run: | + mkdir .\build64 + cd .\build64 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A x64 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017_64" -DDepsPath="${{ github.workspace }}\cmbuild\deps\win64" -DCOPIED_DEPENDENCIES=NO -DCOPY_DEPENDENCIES=YES .. + - name: 'Build OBS-Studio 64-bit' + if: steps.build-cache-obs-64.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio + run: | + msbuild /m /p:Configuration=RelWithDebInfo .\build64\libobs\libobs.vcxproj + msbuild /m /p:Configuration=RelWithDebInfo .\build64\UI\obs-frontend-api\obs-frontend-api.vcxproj + - name: 'Configure obs-websocket 32-bit' + working-directory: ${{ github.workspace }}/obs-websocket + run: | + mkdir .\build32 + cd .\build32 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A Win32 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017" -DLibObs_DIR="${{ github.workspace }}\obs-studio\build32\libobs" -DLIBOBS_INCLUDE_DIR="${{ github.workspace }}\obs-studio\libobs" -DLIBOBS_LIB="${{ github.workspace }}\obs-studio\build32\libobs\RelWithDebInfo\obs.lib" -DOBS_FRONTEND_LIB="${{ github.workspace }}\obs-studio\build32\UI\obs-frontend-api\RelWithDebInfo\obs-frontend-api.lib" .. + - name: 'Configure obs-websocket 64-bit' + working-directory: ${{ github.workspace }}/obs-websocket + run: | + mkdir .\build64 + cd .\build64 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A x64 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017_64" -DLibObs_DIR="${{ github.workspace }}\obs-studio\build64\libobs" -DLIBOBS_INCLUDE_DIR="${{ github.workspace }}\obs-studio\libobs" -DLIBOBS_LIB="${{ github.workspace }}\obs-studio\build64\libobs\RelWithDebInfo\obs.lib" -DOBS_FRONTEND_LIB="${{ github.workspace }}\obs-studio\build64\UI\obs-frontend-api\RelWithDebInfo\obs-frontend-api.lib" .. + - name: 'Build obs-websocket 32-bit' + working-directory: ${{ github.workspace }}/obs-websocket + run: msbuild /m /p:Configuration=RelWithDebInfo .\build32\obs-websocket.sln + - name: 'Build obs-websocket 64-bit' + working-directory: ${{ github.workspace }}/obs-websocket + run: msbuild /m /p:Configuration=RelWithDebInfo .\build64\obs-websocket.sln + - name: 'Set PR artifact filename' + shell: bash + run: | + FILENAME="obs-websocket-${{ env.GIT_HASH }}-Windows" + echo "::set-env name=FILENAME::$FILENAME" + - name: 'Package obs-websocket' + working-directory: ${{ github.workspace }}/obs-websocket + run: | + mkdir package + cd package + 7z a "${{ env.WIN_FILENAME }}.zip" "..\release\*" + iscc ..\installer\installer.iss /O. /F"${{ env.WIN_FILENAME }}-Installer" + - name: 'Publish ${{ env.WIN_FILENAME }}.zip' + if: success() + uses: actions/upload-artifact@v2-preview + with: + name: '${{ env.GIT_HASH }}-Windows' + path: ${{ github.workspace }}/obs-websocket/package/*.zip + - name: 'Publish ${{ env.WIN_FILENAME }}-Installer.exe' + if: success() + uses: actions/upload-artifact@v2-preview + with: + name: '${{ env.GIT_HASH }}-Windows-Installer' + path: ${{ github.workspace }}/obs-websocket/package/*.exe \ No newline at end of file