1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00

ci: add old macos sdk

This commit is contained in:
Roman Khafizianov 2024-07-05 15:21:30 +02:00
parent b7a20dd354
commit 68d6e2b3ec
No known key found for this signature in database
GPG key ID: F07A7D55A2684852
2 changed files with 32 additions and 3 deletions

27
.github/install_macos_sdk.sh vendored Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Install an older MacOS SDK
# This should guarantee OpenMM builds with extended compatibility across MacOS versions
# Taken from
# https://github.com/openmm/openmm/blob/master/devtools/ci/gh-actions/scripts/install_macos_sdk.sh
OSX_SDK_DIR="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs"
export MACOSX_DEPLOYMENT_TARGET=10.15
export MACOSX_SDK_VERSION=10.15
export OSX_SYSROOT="${OSX_SDK_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk"
if [[ ! -d ${OSX_SYSROOT}} ]]; then
echo "Downloading ${MACOSX_SDK_VERSION} sdk"
curl -L -O --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 40 --retry-connrefused --retry-all-errors \
https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz
tar -xf MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz -C "$(dirname ${OSX_SYSROOT})"
fi
if [[ "$MACOSX_DEPLOYMENT_TARGET" == 10.* ]]; then
# set minimum sdk version to our target
plutil -replace MinimumSDKVersion -string ${MACOSX_SDK_VERSION} $(xcode-select -p)/Platforms/MacOSX.platform/Info.plist
plutil -replace DTSDKName -string macosx${MACOSX_SDK_VERSION}internal $(xcode-select -p)/Platforms/MacOSX.platform/Info.plist
fi
echo "MACOSX_SDK_ROOT=${OSX_SYSROOT}" >> ${GITHUB_ENV}

View file

@ -32,7 +32,7 @@ permissions:
name: Build
jobs:
build:
runs-on: ${{ github.event_name == 'push' && 'macos-11' || (github.event.inputs.run-on-runner || 'self-hosted') }}
runs-on: ${{ github.event_name == 'push' && 'macos-12' || (github.event.inputs.run-on-runner || 'self-hosted') }}
steps:
- name: validate agent
run: |
@ -51,6 +51,8 @@ jobs:
echo GOPATH=$(go env GOPATH) >> $GITHUB_ENV
echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
echo $(go env GOPATH)/bin >> $GITHUB_PATH
- name: Install old MacOS SDK (for backward compatibility)
run: source .github/install_macos_sdk.sh
- name: Install patched gox
run: |
mkdir -p "$GOPATH/src/github.com/mitchellh"
@ -85,7 +87,7 @@ jobs:
INHOUSE_KEY: ${{ secrets.INHOUSE_KEY }}
run: |
GIT_SUMMARY=$(git describe --tags --always)
echo "FLAGS=-X github.com/anyproto/anytype-heart/util/vcs.GitSummary=${GIT_SUMMARY} -X github.com/anyproto/anytype-heart/metrics.DefaultInHouseKey=${INHOUSE_KEY} -X github.com/anyproto/anytype-heart/util/unsplash.DefaultToken=${UNSPLASH_KEY}" >> $GITHUB_ENV
echo "FLAGS=-isysroot ${MACOSX_SDK_ROOT} -X github.com/anyproto/anytype-heart/util/vcs.GitSummary=${GIT_SUMMARY} -X github.com/anyproto/anytype-heart/metrics.DefaultInHouseKey=${INHOUSE_KEY} -X github.com/anyproto/anytype-heart/util/unsplash.DefaultToken=${UNSPLASH_KEY}" >> $GITHUB_ENV
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION=${{ github.event.inputs.alpha_version }}
if [ -z "$VERSION" ]; then
@ -335,7 +337,7 @@ jobs:
run: |
GIT_SUMMARY=$(git describe --tags --always)
echo GOPRIVATE=github.com/anyproto >> $GITHUB_ENV
echo "FLAGS=-X github.com/anyproto/anytype-heart/util/vcs.GitSummary=${GIT_SUMMARY} -X github.com/anyproto/anytype-heart/metrics.DefaultInHouseKey=${INHOUSE_KEY} -X github.com/anyproto/anytype-heart/util/unsplash.DefaultToken=${UNSPLASH_KEY}" >> $GITHUB_ENV
echo "-X github.com/anyproto/anytype-heart/util/vcs.GitSummary=${GIT_SUMMARY} -X github.com/anyproto/anytype-heart/metrics.DefaultInHouseKey=${INHOUSE_KEY} -X github.com/anyproto/anytype-heart/util/unsplash.DefaultToken=${UNSPLASH_KEY}" >> $GITHUB_ENV
echo VERSION=${GITHUB_REF##*/} >> $GITHUB_ENV
git config --global url."https://${{ secrets.ANYTYPE_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Go mod download