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" 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 echo "::group::Prepare artifacts folder" mkdir artifacts ARTIFACTS="$GITHUB_WORKSPACE/artifacts" cd src/out/Release${{ inputs.build_type_suffix }} 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