146 lines
4.9 KiB
YAML
146 lines
4.9 KiB
YAML
name: Build and Test PR
|
|
|
|
# Builds and tests on all combinations of OS, build type, and library type.
|
|
# Also builds the docs.
|
|
#
|
|
# Runs when a pull request is opened or updated.
|
|
#
|
|
# Can also be run manually for debugging purposes.
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
description: "The ref to build and test."
|
|
required: False
|
|
|
|
# If another instance of this workflow is started for the same PR, cancel the
|
|
# old one. If a PR is updated and a new test run is started, the old test run
|
|
# will be cancelled automatically to conserve resources.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.inputs.ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: src
|
|
ref: ${{ github.event.inputs.ref || github.ref }}
|
|
# This makes the merge base available for the C++ linter, so that it
|
|
# can tell which files have changed.
|
|
fetch-depth: 2
|
|
|
|
- name: Lint
|
|
uses: ./src/.github/workflows/custom-actions/lint-packager
|
|
|
|
build_and_test:
|
|
# Doesn't really "need" it, but let's not waste time on an expensive matrix
|
|
# build step just to cancel it because of a linter error.
|
|
needs: lint
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# NOTE: macos-10.15 is required for now, to work around issues with our
|
|
# build system. The same is true for windows-2019. See related
|
|
# comments in
|
|
# .github/workflows/custom-actions/build-packager/action.yaml
|
|
os: ["ubuntu-latest", "macos-10.15", "windows-2019", "self-hosted-linux-arm64"]
|
|
build_type: ["Debug", "Release"]
|
|
lib_type: ["static", "shared"]
|
|
include:
|
|
- os: ubuntu-latest
|
|
os_name: linux
|
|
target_arch: x64
|
|
exe_ext: ""
|
|
build_type_suffix: ""
|
|
- os: macos-10.15
|
|
os_name: osx
|
|
target_arch: x64
|
|
exe_ext: ""
|
|
build_type_suffix: ""
|
|
- os: windows-2019
|
|
os_name: win
|
|
target_arch: x64
|
|
exe_ext: ".exe"
|
|
# 64-bit outputs on Windows go to a different folder name.
|
|
build_type_suffix: "_x64"
|
|
- os: self-hosted-linux-arm64
|
|
os_name: linux
|
|
target_arch: arm64
|
|
exe_ext: ""
|
|
build_type_suffix: ""
|
|
|
|
name: Build and test ${{ matrix.os_name }} ${{ matrix.target_arch }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Configure git to preserve line endings
|
|
# Otherwise, tests fail on Windows because "golden" test outputs will not
|
|
# have the correct line endings.
|
|
run: git config --global core.autocrlf false
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: src
|
|
ref: ${{ github.event.inputs.ref || github.ref }}
|
|
|
|
- name: Build docs (Linux only)
|
|
if: runner.os == 'Linux'
|
|
uses: ./src/.github/workflows/custom-actions/build-docs
|
|
|
|
- name: Build Packager
|
|
uses: ./src/.github/workflows/custom-actions/build-packager
|
|
with:
|
|
os_name: ${{ matrix.os_name }}
|
|
target_arch: ${{ matrix.target_arch }}
|
|
lib_type: ${{ matrix.lib_type }}
|
|
build_type: ${{ matrix.build_type }}
|
|
build_type_suffix: ${{ matrix.build_type_suffix }}
|
|
exe_ext: ${{ matrix.exe_ext }}
|
|
|
|
- name: Test Packager
|
|
uses: ./src/.github/workflows/custom-actions/test-packager
|
|
with:
|
|
lib_type: ${{ matrix.lib_type }}
|
|
build_type: ${{ matrix.build_type }}
|
|
build_type_suffix: ${{ matrix.build_type_suffix }}
|
|
exe_ext: ${{ matrix.exe_ext }}
|
|
|
|
test_supported_linux_distros:
|
|
# Doesn't really "need" it, but let's not waste time on a series of docker
|
|
# builds just to cancel it because of a linter error.
|
|
needs: lint
|
|
name: Test builds on all supported Linux distros (using docker)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: src
|
|
ref: ${{ github.event.inputs.ref || github.ref }}
|
|
|
|
- name: Install depot tools
|
|
shell: bash
|
|
run: |
|
|
git clone -b chrome/4147 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
touch depot_tools/.disable_auto_update
|
|
echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH
|
|
|
|
- name: Setup gclient
|
|
shell: bash
|
|
run: |
|
|
gclient config https://github.com/shaka-project/shaka-packager.git --name=src --unmanaged
|
|
# NOTE: the docker tests will do gclient runhooks, so skip hooks here.
|
|
gclient sync --nohooks
|
|
|
|
- name: Test all distros
|
|
shell: bash
|
|
run: ./src/packager/testing/dockers/test_dockers.sh
|