-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
action.yml
89 lines (81 loc) 路 3.02 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Pre-bottle-build steps
description: Runs the common steps to be done before building bottles.
inputs:
bottles-directory:
description: Bottles directory
required: true
cleanup:
description: Do cleanup steps?
required: false
default: true
download-bottles:
description: Download bottles built in earlier job?
required: false
default: false
runs:
using: "composite"
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: true
cask: false
test-bot: true
- run: brew test-bot --only-cleanup-before
if: fromJson(inputs.cleanup)
shell: /bin/bash -euo pipefail {0}
- name: Set up RubyGems cache
id: setup-cache
shell: /bin/bash -euo pipefail {0}
run: |
cache_key_prefix="${{ runner.os }}"
if [[ "${{ runner.os }}" = macOS ]]
then
macos_full_version="$(sw_vers -productVersion)"
macos_version="${macos_full_version%%.*}"
arch="$(uname -m)"
cache_key_prefix="${macos_version}-${arch}"
fi
echo "cache_key_prefix=${cache_key_prefix}" >> "$GITHUB_ENV"
echo "macos_version=${macos_version}" >> "$GITHUB_OUTPUT"
echo "arch=${arch}" >> "$GITHUB_OUTPUT"
- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ env.cache_key_prefix }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ env.cache_key_prefix }}-rubygems-
- name: Run brew test-bot --only-setup
run: |
printf '\n<details><summary>brew test-bot --only-setup</summary>\n<p>\n\n' >> "$GITHUB_STEP_SUMMARY"
printf '```\n' >> "${GITHUB_STEP_SUMMARY}"
HOMEBREW_NO_COLOR=1 brew test-bot --only-setup | tee -a "${GITHUB_STEP_SUMMARY}"
printf '```\n' >> "${GITHUB_STEP_SUMMARY}"
printf '\n</p>\n</details>\n' >> "$GITHUB_STEP_SUMMARY"
shell: /bin/bash -euo pipefail {0}
- name: Set up bottles directory
id: setup-bottles
run: |
rm -rvf "${BOTTLES_DIR:?}"
mkdir "${BOTTLES_DIR:?}"
if [[ "${{ runner.os }}" = Linux ]]; then
bottle_specifier="{ubuntu,linux}"
else
bottle_specifier="$MACOS_VERSION"
[[ "$ARCH" = arm64 ]] && bottle_specifier="${bottle_specifier}-${ARCH}"
fi
echo "bottle_specifier=$bottle_specifier" >> "$GITHUB_OUTPUT"
shell: /bin/bash -euo pipefail {0}
env:
BOTTLES_DIR: ${{ inputs.bottles-directory }}
MACOS_VERSION: ${{ steps.setup-cache.outputs.macos_version }}
ARCH: ${{ steps.setup-cache.outputs.arch }}
- name: Download bottles from GitHub Actions
if: fromJson(inputs.download-bottles)
uses: actions/download-artifact@v4
with:
pattern: bottles_${{ steps.setup-bottles.outputs.bottle_specifier }}*
path: ${{ inputs.bottles-directory }}
merge-multiple: true