diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 70edf57e6a..481d0e5dfb 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -38,23 +38,31 @@ jobs: needs: lint strategy: matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] + os: ["ubuntu-latest", "macos-latest", "windows-latest", "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-latest os_name: osx + target_arch: x64 exe_ext: "" build_type_suffix: "" - os: windows-latest 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: linux-arm64 + os_name: linux-arm64 + target_arch: arm64 + exe_ext: "" + build_type_suffix: "" name: Build and test ${{ matrix.os_name }} ${{ matrix.build_type }} ${{ matrix.lib_type }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/custom-actions/build-packager/action.yaml b/.github/workflows/custom-actions/build-packager/action.yaml index 2dfa34192c..11d961f5ca 100644 --- a/.github/workflows/custom-actions/build-packager/action.yaml +++ b/.github/workflows/custom-actions/build-packager/action.yaml @@ -8,6 +8,9 @@ inputs: os_name: description: The name of the OS (one word). Appended to artifact filenames. required: true + target_arch: + description: The CPU architecture to target. We support x64, arm64. + required: true lib_type: description: A library type, either "static" or "shared". required: true @@ -48,6 +51,28 @@ runs: echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH echo "::endgroup::" + - name: Build ninja (arm only) + shell: bash + run: | + # NOTE: There is no prebuilt copy of ninja for the "aarch64" + # architecture (as reported by "uname -p" on arm64). So we must build + # our own, as recommended by depot_tools when it fails to fetch a + # prebuilt copy for us. + # NOTE 2: It turns out that $GITHUB_PATH operates like a stack. + # Appending to that file places the new path at the beginning of $PATH + # for the next step, so this step must come _after_ installing + # depot_tools. + if [[ "${{ inputs.target_arch }}" == "arm64" ]]; then + echo "::group::Build ninja (arm-only)" + git clone https://github.com/ninja-build/ninja.git -b v1.8.2 + # The --bootstrap option compiles ninja as well as configures it. + # This is the exact command prescribed by depot_tools when it fails to + # fetch a ninja binary for your platform. + (cd ninja && ./configure.py --bootstrap) + echo "${GITHUB_WORKSPACE}/ninja" >> $GITHUB_PATH + echo "::endgroup::" + fi + - name: Configure gclient shell: bash run: | @@ -57,7 +82,7 @@ runs: - name: Sync gclient env: - GYP_DEFINES: "target_arch=x64 libpackager_type=${{ inputs.lib_type }}_library" + GYP_DEFINES: "target_arch=${{ inputs.target_arch }} 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 diff --git a/.github/workflows/github_release.yaml b/.github/workflows/github_release.yaml index 860ca48edd..9103417882 100644 --- a/.github/workflows/github_release.yaml +++ b/.github/workflows/github_release.yaml @@ -112,23 +112,31 @@ jobs: needs: [setup, lint, draft_release] strategy: matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] + os: ["ubuntu-latest", "macos-latest", "windows-latest", "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-latest os_name: osx + target_arch: x64 exe_ext: "" build_type_suffix: "" - os: windows-latest 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: linux-arm64 + os_name: linux-arm64 + target_arch: arm64 + exe_ext: "" + build_type_suffix: "" name: Build and test ${{ matrix.os_name }} ${{ matrix.build_type }} ${{ matrix.lib_type }} runs-on: ${{ matrix.os }}