-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test branch] Test osx-arm64 merging to mock target branch (2) (#46961)
* skip remaining steps if no matching platform * fix step syntax * fix variable syntax * bump version * additional logging * standardize name * test skip feature * fix syntax * readd platform * remove extra space * try to fix brew error * bump version * check permission * make the dir * remove caching * remove caching * remove dry run
- Loading branch information
1 parent
750e15b
commit 6f1f1db
Showing
4 changed files
with
73 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# Check to see if any changed recipes have specified the key | ||
# extra:additional-platforms, and if so, if they match the platform of the | ||
# currently-running machine. | ||
|
||
# arguments | ||
git_range=$1 | ||
job_name=$2 | ||
|
||
# Download ARM version of yq | ||
yq_platform=$(uname) | ||
yq_arch=$(uname -m) | ||
[[ $yq_arch = "aarch64" ]] && yq_arch="arm64" | ||
mkdir -p ${HOME}/bin | ||
wget https://github.com/mikefarah/yq/releases/latest/download/yq_${yq_platform}_${yq_arch} -O ${HOME}/bin/yq | ||
chmod +x ${HOME}/bin/yq | ||
|
||
# Find recipes changed from this merge | ||
files=`git diff --name-only --diff-filter AMR ${git_range} | grep -E 'meta.yaml$' ` | ||
build=0 | ||
|
||
for file in $files; do | ||
echo $file | ||
# To create a properly-formatted yaml that yq can parse, comment out jinja2 | ||
# variable setting with {% %} and remove variable use with {{ }}. | ||
additional_platforms=$(cat $file \ | ||
| sed -E 's/(.*)\{%(.*)%\}(.*)/# \1\2\3/g' \ | ||
| tr -d '{{' | tr -d '}}' \ | ||
| ${HOME}/bin/yq '.extra.additional-platforms[]') | ||
# Check if any additional platforms match this job | ||
for additional_platform in $additional_platforms; do | ||
if [ "${GITHUB_JOB}" = "${job_name}-${additional_platform}" ] | ||
then | ||
echo "Found at least one recipe for ${job_name}-${additional_platform}" | ||
build=1 | ||
break | ||
fi | ||
done | ||
done | ||
|
||
# If no changed recipes apply to this platform, skip remaining steps | ||
if [[ build -lt 1 ]] | ||
then | ||
echo "No recipes using this platform, skipping rest of job." | ||
echo "skip_build=true" >> $GITHUB_OUTPUT | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters