134 lines
5.0 KiB
YAML
134 lines
5.0 KiB
YAML
name: Build Shaka Packager
|
|
|
|
description: |
|
|
A reusable action to build Shaka Packager.
|
|
Leaves build artifacts in the "artifacts" folder.
|
|
|
|
inputs:
|
|
os_name:
|
|
description: The name of the OS (one word). Appended to artifact filenames.
|
|
required: true
|
|
lib_type:
|
|
description: A library type, either "static" or "shared".
|
|
required: true
|
|
build_type:
|
|
description: A build type, either "Debug" or "Release".
|
|
required: true
|
|
build_type_suffix:
|
|
description: A suffix to append to the build type in the output path.
|
|
required: false
|
|
default: ""
|
|
exe_ext:
|
|
description: The extension on executable files.
|
|
required: false
|
|
default: ""
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Select Xcode 10.3 and SDK 10.14 (macOS only)
|
|
# NOTE: macOS 11 doesn't work with our (old) version of Chromium build,
|
|
# and the latest Chromium build doesn't work with Packager's build
|
|
# system. To work around this, we need an older SDK version, and to
|
|
# get that, we need an older XCode version. XCode 10.3 has SDK 10.14,
|
|
# which works.
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ runner.os }}" == "macOS" ]]; then
|
|
echo "::group::Select Xcode 10.3"
|
|
sudo xcode-select -s /Applications/Xcode_10.3.app/Contents/Developer
|
|
echo "::endgroup::"
|
|
fi
|
|
|
|
- name: Install depot tools
|
|
shell: bash
|
|
run: |
|
|
echo "::group::Install depot_tools"
|
|
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH
|
|
echo "::endgroup::"
|
|
|
|
- name: Configure gclient
|
|
shell: bash
|
|
run: |
|
|
echo "::group::Configure gclient"
|
|
gclient config https://github.com/google/shaka-packager.git --name=src --unmanaged
|
|
echo "::endgroup::"
|
|
|
|
- name: Sync gclient
|
|
env:
|
|
GYP_DEFINES: "target_arch=x64 libpackager_type=${{ inputs.lib_type }}_library"
|
|
GYP_MSVS_VERSION: "2019"
|
|
GYP_MSVS_OVERRIDE_PATH: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise"
|
|
shell: bash
|
|
run: |
|
|
echo "::group::Sync gclient"
|
|
BUILD_CONFIG="${{ inputs.build_type }}-${{ inputs.lib_type }}"
|
|
if [[ "$BUILD_CONFIG" == "Release-static" && "${{ runner.os }}" == "Linux" ]]; then
|
|
# For static release builds, set these two additional flags for fully static binaries.
|
|
export GYP_DEFINES="$GYP_DEFINES disable_fatal_linker_warnings=1 static_link_binaries=1"
|
|
fi
|
|
gclient sync
|
|
echo "::endgroup::"
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
echo "::group::Build"
|
|
ninja -C src/out/${{ inputs.build_type }}${{ inputs.build_type_suffix }}
|
|
echo "::endgroup::"
|
|
|
|
- name: Prepare artifacts (static release only)
|
|
shell: bash
|
|
run: |
|
|
BUILD_CONFIG="${{ inputs.build_type }}-${{ inputs.lib_type }}"
|
|
if [[ "$BUILD_CONFIG" != "Release-static" ]]; then
|
|
echo "Skipping artifacts for $BUILD_CONFIG."
|
|
exit 0
|
|
fi
|
|
if [[ "${{ runner.os }}" == "Linux" ]]; then
|
|
echo "::group::Check for static executables"
|
|
(
|
|
cd src/out/Release${{ inputs.build_type_suffix }}
|
|
# Prove that we built static executables on Linux. First, check that
|
|
# the executables exist, and fail if they do not. Then check "ldd",
|
|
# which will fail if the executable is not dynamically linked. If
|
|
# "ldd" succeeds, we fail the workflow. Finally, we call "true" so
|
|
# that the last executed statement will be a success, and the step
|
|
# won't be failed if we get that far.
|
|
ls packager mpd_generator >/dev/null || exit 1
|
|
ldd packager 2>&1 && exit 1
|
|
ldd mpd_generator 2>&1 && exit 1
|
|
true
|
|
)
|
|
echo "::endgroup::"
|
|
fi
|
|
echo "::group::Prepare artifacts folder"
|
|
mkdir artifacts
|
|
ARTIFACTS="$GITHUB_WORKSPACE/artifacts"
|
|
cd src/out/Release${{ inputs.build_type_suffix }}
|
|
echo "::endgroup::"
|
|
echo "::group::Strip executables"
|
|
strip packager${{ inputs.exe_ext }}
|
|
strip mpd_generator${{ inputs.exe_ext }}
|
|
echo "::endgroup::"
|
|
echo "::group::Copy packager"
|
|
cp packager${{ inputs.exe_ext }} \
|
|
$ARTIFACTS/packager-${{ inputs.os_name }}${{ inputs.exe_ext }}
|
|
echo "::endgroup::"
|
|
echo "::group::Copy mpd_generator"
|
|
cp mpd_generator${{ inputs.exe_ext }} \
|
|
$ARTIFACTS/mpd_generator-${{ inputs.os_name }}${{ inputs.exe_ext }}
|
|
echo "::endgroup::"
|
|
if [[ '${{ runner.os }}' == 'Windows' ]]; then
|
|
echo "::group::Zip pssh-box"
|
|
7z a $ARTIFACTS/pssh-box-${{ inputs.os_name }}.py.zip \
|
|
pyproto pssh-box.py
|
|
echo "::endgroup::"
|
|
else
|
|
echo "::group::Tar pssh-box"
|
|
tar -czf $ARTIFACTS/pssh-box-${{ inputs.os_name }}.py.tar.gz \
|
|
pyproto pssh-box.py
|
|
echo "::endgroup::"
|
|
fi
|