Merge pull request #11979 from protocolbuffers/22.x-gha-backport

Backport GHA improvements to 22.x
deannagarcia-patch-1
Mike Kruskal 2 years ago committed by GitHub
commit 26d3ca13a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      .github/actions/bazel/action.yml
  2. 4
      .github/actions/internal/bazel-setup/action.yml
  3. 36
      .github/actions/internal/ccache-setup-windows/action.yml
  4. 11
      .github/workflows/codespell.yml
  5. 1
      push_auto_update.sh

@ -93,6 +93,29 @@ runs:
shell: bash shell: bash
run: bazelisk version run: bazelisk version
# Bazel has multiple Xcode calls with hardcoded timeouts. Many of these
# end up timing out on our github runners, causing flakes on every mac
# build that invoked Bazel. To work around this, we manually invoke these
# calls before running Bazel to make sure they end up in Xcode's cache for
# quicker runs later. All of these calls are obtained from xcrun calls in
# https://github.com/bazelbuild/bazel/blob/e8a69f5d5acaeb6af760631490ecbf73e8a04eeb/tools/cpp/osx_cc_configure.bzl.
# See https://github.com/bazelbuild/bazel/issues/17437 for more details.
# TODO(b/269503614) Remove this once Bazel provides an official solution.
- name: Warm up Xcode
if: ${{ runner.os == 'macOS' }}
shell: bash
run: |
mkdir -p mac_bazel_workaround
bazelisk ${{ steps.bazel.outputs.bazel-startup-flags }} build @bazel_tools//tools/osx:xcode_locator.m $BAZEL_FLAGS
XCODE_LOCATOR_FLAGS="--sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices -framework Foundation"
SINGLE_ARCH_COMPILE_FLAGS="--sdk macosx clang -mmacosx-version-min=10.9 -std=c++11 -lc++ -O3"
COMPILE_FLAGS="$SINGLE_ARCH_COMPILE_FLAGS -arch arm64 -arch x86_64 -Wl,-no_adhoc_codesign -Wl,-no_uuid -O3"
time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $XCODE_LOCATOR_FLAGS -o mac_bazel_workaround/xcode-locator-bin $(bazel info output_base)/external/bazel_tools/tools/osx/xcode_locator.m
time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $SINGLE_ARCH_COMPILE_FLAGS -o mac_bazel_workaround/libtool_check_unique $(bazel info output_base)/external/bazel_tools/tools/objc/libtool_check_unique.cc
time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $COMPILE_FLAGS -o mac_bazel_workaround/libtool_check_unique $(bazel info output_base)/external/bazel_tools/tools/objc/libtool_check_unique.cc
time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $SINGLE_ARCH_COMPILE_FLAGS -o mac_bazel_workaround/wrapped_clang $(bazel info output_base)/external/bazel_tools/tools/osx/crosstool/wrapped_clang.cc
time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $COMPILE_FLAGS -o mac_bazel_workaround/wrapped_clang $(bazel info output_base)/external/bazel_tools/tools/osx/crosstool/wrapped_clang.cc
- name: Run Bash - name: Run Bash
if: ${{ inputs.bash }} if: ${{ inputs.bash }}
run: ${{ inputs.bash }} run: ${{ inputs.bash }}

@ -42,7 +42,9 @@ runs:
- name: Initialize MacOS-specific Bazel flags - name: Initialize MacOS-specific Bazel flags
if: runner.os == 'macOS' if: runner.os == 'macOS'
shell: bash shell: bash
run: echo "BAZEL_FLAGS=$BAZEL_FLAGS --xcode_version_config=//.github:host_xcodes" >> $GITHUB_ENV run: |
echo "BAZEL_FLAGS=$BAZEL_FLAGS --xcode_version_config=//.github:host_xcodes" >> $GITHUB_ENV
echo "DEVELOPER_DIR=${{ env.DEVELOPER_DIR || '/Applications/Xcode_14.1.app/Contents/Developer' }}" >> $GITHUB_ENV
- name: Configure Bazel caching - name: Configure Bazel caching
# Skip bazel cache for local act runs due to issue with credential files # Skip bazel cache for local act runs due to issue with credential files

@ -16,9 +16,41 @@ runs:
arch: x64 arch: x64
vsversion: '2019' vsversion: '2019'
- name: Install ccache - name: Setup ccache path
shell: bash shell: bash
run: choco install ccache --version=4.7.4 run: |
echo "CCACHE_EXE_PATH=$LOCALAPPDATA\ccache-${{ inputs.ccache-version }}-windows-x86_64" >> $GITHUB_ENV
echo "$LOCALAPPDATA\ccache-${{ inputs.ccache-version }}-windows-x86_64" >> $GITHUB_PATH
- name: Add ccache to Powershell path
shell: pwsh
run: echo "%LOCALAPPDATA%\ccache-${{ inputs.ccache-version }}-windows-x86_64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Setup caching of ccache download
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
id: ccache-cache
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: ${{ env.CCACHE_EXE_PATH }}
key: ccache-exe-${{ inputs.ccache-version }}
- name: Restore ccache download
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
id: ccache-restore
uses: actions/cache/restore@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: ${{ env.CCACHE_EXE_PATH }}
key: ccache-exe-${{ inputs.ccache-version }}
- name: Download ccache
shell: bash
if: ${{ steps.ccache-cache.outputs.cache-hit != 'true' && steps.ccache-restore.outputs.cache-hit != 'true'}}
run: |
cd $LOCALAPPDATA
curl -kLSs "https://github.com/ccache/ccache/releases/download/v${{ inputs.ccache-version }}/ccache-${{ inputs.ccache-version }}-windows-x86_64.zip" -o ccache.zip
unzip ccache.zip
rm ccache.zip
ccache --version
- name: Configure ccache environment variables - name: Configure ccache environment variables
shell: pwsh shell: pwsh

@ -2,7 +2,16 @@
# https://github.com/codespell-project/actions-codespell # https://github.com/codespell-project/actions-codespell
# https://github.com/codespell-project/codespell # https://github.com/codespell-project/codespell
name: codespell name: codespell
on: [push, pull_request] on:
push:
branches:
- main
- '[0-9]+.x'
pull_request:
branches:
- main
- '[0-9]+.x'
permissions: permissions:
contents: read # to fetch code (actions/checkout) contents: read # to fetch code (actions/checkout)
jobs: jobs:

@ -39,6 +39,7 @@ else
commit_message="Auto-generate files" commit_message="Auto-generate files"
fi fi
git pull --rebase
git add -A git add -A
git diff --staged --quiet || git commit -am "$commit_message" git diff --staged --quiet || git commit -am "$commit_message"
git push git push

Loading…
Cancel
Save