github的action使用
action的基本作用
2019年底,github支持了action,针对持续集成的福音,可以帮助开源社区开发者边写代码边打包集成自己的开源产品模块。
整个流程的使用,非常简单,跟github无缝对接。使用了action后,只需要编写自己的项目代码,提交,就会自动在不同平台编译打包生成开源模块。
action的基本使用
action的使用,类似我们使用linux的shell一样,基本方法是编写yml配置,具体的编写方法,在打开action时自动生成模板介绍,github无缝接入了doc,可以边写边查doc文档其中的命令使用。
以一个示例来说明:
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "win32"
win32:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0
with:
vs-version: 15
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: "recursive"
# Runs a single command using the runners shell
- name: build
run: msbuild /m /p:Configuration=Release /p:Platform=x86 .\TestProj\TestProj.sln
# Package
- name: package
run: |
$env:FILE_DATE=(Get-Date -UFormat "%F")
$env:FILE_NAME="KeenTestProj-win32-${env:FILE_DATE}.zip"
mkdir .\build
xcopy .\TestProj\Release\TestProj.exe .\build /Y
xcopy .\TestProj\Release\TestProj.pdb .\build /Y
7z a ${env:FILE_NAME} .\build\*
- name: Publish
uses: actions/upload-artifact@v2-preview
with:
name: '$'
path: '*.zip'
action的优势
它的优势主要表现在如下几点:
- 提供了免费的虚拟机资源(win、linux、mac都有),2核心CPU、7G内存、14G SSD存储硬件配置。
- 可以打包任意平台,方便跨平台开发(后面有obs studio的打包示例)
- github的action市场提供了丰富的插件,一键安装需要的环境,例如Go环境,只需要跳转到action市场,一行脚本就可以准备好go环境安装,类似linux中的软件商店
- 可以定制各种事件触发,比如在release分支被push时,触发action执行等。
- 提供免费的cdn存储,打包完的数据包,action市场提供了upload-artifact,自动上传安装包或者压缩包,提供链接给其他人预览。
obs studio跨平台打包示例
https://github.com/obsproject/obs-studio/actions/runs/117291796/workflow
name: 'CI Multiplatform Build'
on:
push:
branches:
- master
pull_request:
paths-ignore:
- '**.md'
branches:
- master
env:
CEF_BUILD_VERSION: '3770'
CEF_VERSION: '75.1.16+g16a67c4+chromium-75.0.3770.100'
jobs:
macos64:
name: 'macOS 64-bit'
runs-on: [macos-latest]
env:
MACOS_DEPS_VERSION: '2020-04-24'
VLC_VERSION: '3.0.8'
SPARKLE_VERSION: '1.23.0'
QT_VERSION: '5.14.1'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: 'Fetch Git Tags'
run: |
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: 'Install prerequisites (Homebrew)'
shell: bash
run: |
if [ -d "$(brew --cellar)/swig" ]; then
brew unlink swig
fi
if [ -d "$(brew --cellar)/qt" ]; then
brew unlink qt
fi
brew bundle --file ./CI/scripts/macos/Brewfile
- name: 'Restore Chromium Embedded Framework from cache'
id: cef-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'cef-cache'
with:
path: $/cmbuild/cef_binary_$_macosx64
key: $-pr-$-$
- name: 'Restore pre-built dependencies from cache'
id: deps-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'deps-cache'
with:
path: /tmp/obsdeps
key: $-pr-$-$
- name: 'Restore VLC dependency from cache'
id: vlc-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'vlc-cache'
with:
path: $/cmbuild/vlc-$
key: $-pr-$-$
- name: 'Restore Sparkle dependency from cache'
id: sparkle-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'sparkle-cache'
with:
path: $/cmbuild/sparkle
key: $-pr-$-$
- name: 'Install prerequisite: Pre-built dependencies'
if: steps.deps-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L -O https://github.com/obsproject/obs-deps/releases/download/$/osx-deps-$.tar.gz
tar -xf ./osx-deps-$.tar.gz -C "/tmp"
- name: 'Install prerequisite: VLC'
if: steps.vlc-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L -O https://downloads.videolan.org/vlc/$/vlc-$.tar.xz
if [ ! -d "$/cmbuild" ]; then mkdir "$/cmbuild"; fi
tar -xf ./vlc-$.tar.xz -C "$/cmbuild"
- name: 'Install prerequisite: Sparkle'
if: steps.sparkle-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L -o sparkle.tar.bz2 https://github.com/sparkle-project/Sparkle/releases/download/$/Sparkle-$.tar.bz2
mkdir $/cmbuild/sparkle
tar -xf ./sparkle.tar.bz2 -C $/cmbuild/sparkle
- name: 'Setup prerequisite: Sparkle'
shell: bash
run: sudo cp -R $/cmbuild/sparkle/Sparkle.framework /Library/Frameworks/Sparkle.framework
- name: 'Install prerequisite: Chromium Embedded Framework'
if: steps.cef-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L -O https://obs-nightly.s3-us-west-2.amazonaws.com/cef_binary_$_macosx64.tar.bz2
tar -xf ./cef_binary_$_macosx64.tar.bz2 -C $/cmbuild/
cd $/cmbuild/cef_binary_$_macosx64
sed -i '.orig' '/add_subdirectory(tests\/ceftests)/d' ./CMakeLists.txt
# target 10.11
sed -i '.orig' s/\"10.9\"/\"10.11\"/ ./cmake/cef_variables.cmake
mkdir build && cd build
cmake -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 ..
make -j4
mkdir libcef_dll
cd ../../
- name: 'Configure'
shell: bash
run: |
mkdir ./build
cd ./build
cmake -DENABLE_SPARKLE_UPDATER=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DQTDIR="/usr/local/Cellar/qt/$" -DDepsPath="/tmp/obsdeps" -DVLCPath="$/cmbuild/vlc-$" -DBUILD_BROWSER=ON -DBROWSER_DEPLOY=ON -DBUILD_CAPTIONS=ON -DWITH_RTMPS=ON -DCEF_ROOT_DIR="$/cmbuild/cef_binary_$_macosx64" ..
- name: 'Build'
shell: bash
working-directory: $/build
run: make -j4
- name: 'Install prerequisite: Packages app'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
shell: bash
run: |
curl -L -O https://s3-us-west-2.amazonaws.com/obs-nightly/Packages.pkg
sudo installer -pkg ./Packages.pkg -target /
- name: 'Install prerequisite: DMGbuild'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
shell: bash
run: |
pip3 install dmgbuild
- name: 'Create macOS application bundle'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
working-directory: $/build
shell: bash
run: |
if [ -d ./OBS.app ]; then rm -rf ./OBS.app; fi
mkdir -p OBS.app/Contents/MacOS
mkdir OBS.app/Contents/PlugIns
mkdir OBS.app/Contents/Resources
cp -R rundir/RelWithDebInfo/bin/ ./OBS.app/Contents/MacOS
cp -R rundir/RelWithDebInfo/data ./OBS.app/Contents/Resources
cp ../CI/scripts/macos/app/obs.icns ./OBS.app/Contents/Resources
cp -R rundir/RelWithDebInfo/obs-plugins/ ./OBS.app/Contents/PlugIns
cp ../CI/scripts/macos/app/Info.plist ./OBS.app/Contents
if [ -d ./OBS.app/Contents/Resources/data/obs-scripting ]; then
mv ./OBS.app/Contents/Resources/data/obs-scripting/obslua.so ./OBS.app/Contents/MacOS/
mv ./OBS.app/Contents/Resources/data/obs-scripting/_obspython.so ./OBS.app/Contents/MacOS/
mv ./OBS.app/Contents/Resources/data/obs-scripting/obspython.py ./OBS.app/Contents/MacOS/
rm -rf ./OBS.app/Contents/Resources/data/obs-scripting/
fi
install_name_tool -change libmbedtls.12.dylib @executable_path/../Frameworks/libmbedtls.12.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
install_name_tool -change libmbedcrypto.3.dylib @executable_path/../Frameworks/libmbedcrypto.3.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
install_name_tool -change libmbedx509.0.dylib @executable_path/../Frameworks/libmbedx509.0.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
../CI/scripts/macos/app/dylibBundler -cd -of -a ./OBS.app -q -f \
-s ./OBS.app/Contents/MacOS \
-s "$/cmbuild/sparkle/Sparkle.framework" \
-x ./OBS.app/Contents/PlugIns/coreaudio-encoder.so \
-x ./OBS.app/Contents/PlugIns/decklink-ouput-ui.so \
-x ./OBS.app/Contents/PlugIns/frontend-tools.so \
-x ./OBS.app/Contents/PlugIns/image-source.so \
-x ./OBS.app/Contents/PlugIns/linux-jack.so \
-x ./OBS.app/Contents/PlugIns/mac-avcapture.so \
-x ./OBS.app/Contents/PlugIns/mac-capture.so \
-x ./OBS.app/Contents/PlugIns/mac-decklink.so \
-x ./OBS.app/Contents/PlugIns/mac-syphon.so \
-x ./OBS.app/Contents/PlugIns/mac-vth264.so \
-x ./OBS.app/Contents/PlugIns/obs-browser.so \
-x ./OBS.app/Contents/PlugIns/obs-browser-page \
-x ./OBS.app/Contents/PlugIns/obs-ffmpeg.so \
-x ./OBS.app/Contents/PlugIns/obs-filters.so \
-x ./OBS.app/Contents/PlugIns/obs-transitions.so \
-x ./OBS.app/Contents/PlugIns/obs-vst.so \
-x ./OBS.app/Contents/PlugIns/rtmp-services.so \
-x ./OBS.app/Contents/MacOS/obs-ffmpeg-mux \
-x ./OBS.app/Contents/MacOS/obslua.so \
-x ./OBS.app/Contents/MacOS/_obspython.so \
-x ./OBS.app/Contents/PlugIns/obs-x264.so \
-x ./OBS.app/Contents/PlugIns/text-freetype2.so \
-x ./OBS.app/Contents/PlugIns/obs-libfdk.so \
-x ./OBS.app/Contents/PlugIns/obs-outputs.so
mv ./OBS.app/Contents/MacOS/libobs-opengl.so ./OBS.app/Contents/Frameworks
sudo cp -R "$/cmbuild/cef_binary_$_macosx64/Release/Chromium Embedded Framework.framework" ./OBS.app/Contents/Frameworks/
sudo chown -R $(whoami) ./OBS.app/Contents/Frameworks/
install_name_tool -change /usr/local/Cellar/qt/$/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ./OBS.app/Contents/Plugins/obs-browser.so
install_name_tool -change /usr/local/Cellar/qt/$/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./OBS.app/Contents/Plugins/obs-browser.so
install_name_tool -change /usr/local/Cellar/qt/$/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ./OBS.app/Contents/Plugins/obs-browser.so
cp ../CI/scripts/macos/app/OBSPublicDSAKey.pem ./OBS.app/Contents/Resources
plutil -insert CFBundleVersion -string $-$ ./OBS.app/Contents/Info.plist
plutil -insert CFBundleShortVersionString -string $-$ ./OBS.app/Contents/Info.plist
plutil -insert OBSFeedsURL -string https://obsproject.com/osx_update/feeds.xml ./OBS.app/Contents/Info.plist
plutil -insert SUFeedURL -string https://obsproject.com/osx_update/stable/updates.xml ./OBS.app/Contents/Info.plist
plutil -insert SUPublicDSAKeyFile -string OBSPublicDSAKey.pem ./OBS.app/Contents/Info.plist
- name: 'Package'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
working-directory: $/build
shell: bash
run: |
FILE_DATE=$(date +%Y-%m-%d)
FILE_NAME=$FILE_DATE-$-$-macOS.dmg
echo "::set-env name=FILE_NAME::${FILE_NAME}"
cp ../CI/scripts/macos/package/settings.json.template ./settings.json
sed -i '' 's#\$\$VERSION\$\$#$#g' ./settings.json
sed -i '' 's#\$\$CI_PATH\$\$#../CI/scripts/macos#g' ./settings.json
sed -i '' 's#\$\$BUNDLE_PATH\$\$#$/build#g' ./settings.json
dmgbuild "OBS-Studio $" "${FILE_NAME}" -s ./settings.json
mkdir ../nightly
sudo mv ./${FILE_NAME} ../nightly/${FILE_NAME}
- name: 'Publish'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
uses: actions/upload-artifact@v2-preview
with:
name: '$'
path: ./nightly/*.dmg
ubuntu64:
name: 'Linux/Ubuntu 64-bit'
runs-on: [ubuntu-latest]
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: 'Fetch Git Tags'
run: |
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: Install prerequisites (Apt)
shell: bash
run: |
sudo dpkg --add-architecture amd64
sudo apt-get -qq update
sudo apt-get install -y \
build-essential \
checkinstall \
cmake \
libasound2-dev \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
libcurl4-openssl-dev \
libfdk-aac-dev \
libfontconfig-dev \
libfreetype6-dev \
libgl1-mesa-dev \
libjack-jackd2-dev \
libjansson-dev \
libluajit-5.1-dev \
libpulse-dev \
libqt5x11extras5-dev \
libspeexdsp-dev \
libswresample-dev \
libswscale-dev \
libudev-dev \
libv4l-dev \
libva-dev \
libvlc-dev \
libx11-dev \
libx264-dev \
libxcb-randr0-dev \
libxcb-shm0-dev \
libxcb-xinerama0-dev \
libxcomposite-dev \
libxinerama-dev \
libmbedtls-dev \
pkg-config \
python3-dev \
qtbase5-dev \
libqt5svg5-dev \
swig
- name: 'Restore Chromium Embedded Framework from cache'
id: cef-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'cef-cache'
with:
path: $/cmbuild/cef_binary_$_linux64
key: $-pr-$-$
- name: 'Install prerequisite: Chromium Embedded Framework'
if: steps.cef-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -kL https://cdn-fastly.obsproject.com/downloads/cef_binary_$_linux64.tar.bz2 -f --retry 5 -o cef.tar.bz2
if [ ! -d "$/cmbuild" ]; then mkdir "$/cmbuild"; fi
tar -C"$/cmbuild" -xjf cef.tar.bz2
- name: 'Configure'
shell: bash
run: |
mkdir ./build
cd ./build
cmake -DUNIX_STRUCTURE=0 -DCMAKE_INSTALL_PREFIX="$/obs-studio-portable" -DBUILD_CAPTIONS=ON -DWITH_RTMPS=ON -DBUILD_BROWSER=ON -DCEF_ROOT_DIR="$/cmbuild/cef_binary_$_linux64" ..
- name: 'Build'
shell: bash
working-directory: $/build
run: make -j4
- name: 'Package'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
shell: bash
run: |
FILE_DATE=$(date +%Y-%m-%d)
FILE_NAME=$FILE_DATE-$-$-linux64.tar.gz
echo "::set-env name=FILE_NAME::${FILE_NAME}"
cd ./build
sudo checkinstall --default --install=no --pkgname=obs-studio --fstrans=yes --backup=no --pkgversion="$(date +%Y%m%d)-git" --deldoc=yes
mkdir ../nightly
tar -cvzf "${FILE_NAME}" *.deb
mv "${FILE_NAME}" ../nightly/
cd -
- name: 'Publish'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
uses: actions/upload-artifact@v2-preview
with:
name: '$'
path: './nightly/*.tar.gz'
win64:
name: 'Windows 64-bit'
runs-on: [windows-latest]
env:
QT_VERSION: '5.10.1'
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
WINDOWS_DEPS_VERSION: '2017'
VLC_VERSION: '3.0.0-git'
TWITCH-CLIENTID: $
TWITCH-HASH: $
MIXER-CLIENTID: $
MIXER-HASH: $
RESTREAM-CLIENTID: $
RESTREAM-HASH: $
steps:
- name: 'Add msbuild to PATH'
uses: microsoft/setup-msbuild@v1.0.0
- name: 'Checkout'
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: 'Fetch Git Tags'
shell: bash
run: |
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: 'Restore QT dependency from cache'
id: qt-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'windows-qt-cache'
with:
path: $/cmbuild/QT
key: $-pr-$-$
- name: 'Restore pre-built dependencies from cache'
id: deps-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'windows-deps-cache'
with:
path: $/cmbuild/deps
key: $-pr-$-$
- name: 'Restore VLC dependency from cache'
id: vlc-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'windows-vlc-cache'
with:
path: $/cmbuild/vlc
key: $-pr-$-$
- name: 'Restore CEF dependency from cache (64 bit)'
id: cef-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'windows-cef-64-cache'
with:
path: $/cmdbuild/cef_binary_$_windows64_minimal
key: $-pr-$-$
- name: 'Install prerequisite: QT'
if: steps.qt-cache.outputs.cache-hit != 'true'
run: |
curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_$.7z -f --retry 5 -C -
7z x Qt_$.7z -o"$/cmbuild/QT"
- name: 'Install prerequisite: Pre-built dependencies'
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies$.zip -f --retry 5 -C -
7z x dependencies$.zip -o"$/cmbuild/deps"
- name: 'Install prerequisite: VLC'
if: steps.vlc-cache.outputs.cache-hit != 'true'
run: |
curl -kL https://cdn-fastly.obsproject.com/downloads/vlc.zip -f --retry 5 -o vlc.zip
7z x vlc.zip -o"$/cmbuild/vlc"
- name: 'Install prerequisite: Chromium Embedded Framework'
if: steps.cef-cache.outputs.cache-hit != 'true'
run: |
curl -kL https://cdn-fastly.obsproject.com/downloads/cef_binary_$_windows64_minimal.zip -f --retry 5 -o cef.zip
7z x cef.zip -o"$/cmbuild"
- name: 'Configure'
run: |
mkdir ./build
mkdir ./build64
cd ./build64
cmake -G"$" -A"x64" -DCMAKE_SYSTEM_VERSION="$" -DBUILD_BROWSER=true -DBUILD_CAPTIONS=true -DCOMPILE_D3D12_HOOK=true -DDepsPath="$/cmbuild/deps/win64" -DQTDIR="$/cmbuild/QT/$/msvc2017_64" -DCEF_ROOT_DIR="$/cmdbuild/cef_binary_$_windows64_minimal" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
- name: 'Build'
run: msbuild /m /p:Configuration=RelWithDebInfo .\build64\obs-studio.sln
- name: 'Package'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
run: |
$env:FILE_DATE=(Get-Date -UFormat "%F")
$env:FILE_NAME="${env:FILE_DATE}-$-$-win64.zip"
echo "::set-env name=FILE_NAME::${env:FILE_NAME}"
robocopy .\build64\rundir\RelWithDebInfo .\build\ /E /XF .gitignore
7z a ${env:FILE_NAME} .\build\*
- name: 'Publish'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
uses: actions/upload-artifact@v2-preview
with:
name: '$'
path: '*-win64.zip'
win32:
name: 'Windows 32-bit'
runs-on: [windows-latest]
env:
QT_VERSION: '5.10.1'
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
WINDOWS_DEPS_VERSION: '2017'
TWITCH-CLIENTID: $
TWITCH-HASH: $
MIXER-CLIENTID: $
MIXER-HASH: $
RESTREAM-CLIENTID: $
RESTREAM-HASH: $
steps:
- name: 'Add msbuild to PATH'
uses: microsoft/setup-msbuild@v1.0.0
- name: 'Checkout'
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: 'Fetch Git Tags'
shell: bash
run: |
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: 'Restore QT dependency from cache'
id: qt-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'qt-cache'
with:
path: $/cmbuild/QT
key: $-pr-$-$
- name: 'Restore pre-built dependencies from cache'
id: deps-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'deps-cache'
with:
path: $/cmbuild/deps
key: $-pr-$-$
- name: 'Restore VLC dependency from cache'
id: vlc-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'vlc-cache'
with:
path: $/cmbuild/vlc
key: $-pr-$-$
- name: 'Restore CEF dependency from cache (32 bit)'
id: cef-cache
uses: actions/cache@v1
env:
CACHE_NAME: 'cef-32-cache'
with:
path: $/cmdbuild/cef_binary_$_windows32_minimal
key: $-pr-$-$
- name: 'Install prerequisite: QT'
if: steps.qt-cache.outputs.cache-hit != 'true'
run: |
curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_$.7z -f --retry 5 -C -
7z x Qt_$.7z -o"$/cmbuild/QT"
- name: 'Install prerequisite: Pre-built dependencies'
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies$.zip -f --retry 5 -C -
7z x dependencies$.zip -o"$/cmbuild/deps"
- name: 'Install prerequisite: VLC'
if: steps.vlc-cache.outputs.cache-hit != 'true'
run: |
curl -kL https://cdn-fastly.obsproject.com/downloads/vlc.zip -f --retry 5 -o vlc.zip
7z x vlc.zip -o"$/cmbuild/vlc"
- name: 'Install prerequisite: Chromium Embedded Framework'
if: steps.cef-cache.outputs.cache-hit != 'true'
run: |
curl -kL https://cdn-fastly.obsproject.com/downloads/cef_binary_$_windows32_minimal.zip -f --retry 5 -o cef.zip
7z x cef.zip -o"$/cmbuild"
- name: 'Configure'
run: |
mkdir ./build
mkdir ./build32
cd ./build32
cmake -G"$" -A"Win32" -DCMAKE_SYSTEM_VERSION="$" -DBUILD_BROWSER=true -DBUILD_CAPTIONS=true -DCOMPILE_D3D12_HOOK=true -DDepsPath="$/cmbuild/deps/win32" -DQTDIR="$/cmbuild/QT/$/msvc2017" -DCEF_ROOT_DIR="$/cmdbuild/cef_binary_$_windows32_minimal" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
- name: 'Build'
run: msbuild /m /p:Configuration=RelWithDebInfo .\build32\obs-studio.sln
- name: 'Package'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
run: |
$env:FILE_DATE=(Get-Date -UFormat "%F")
$env:FILE_NAME="${env:FILE_DATE}-$-$-win32.zip"
echo "::set-env name=FILE_NAME::${env:FILE_NAME}"
robocopy .\build32\rundir\RelWithDebInfo .\build\ /E /XF .gitignore
7z a ${env:FILE_NAME} .\build\*
- name: 'Publish'
if: success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
uses: actions/upload-artifact@v2-preview
with:
name: '$'
path: '*-win32.zip'