Skip to content

Commit 86af12a

Browse files
committed
Fix CI not handling Xcode version correctly with packages
In the CI setup, xcode-select is only called after the packages have been set up, but during setup we actually need to build the packages from source to have the correct deployment target linked correctly. This means we could potentially be building with the wrong configuration (e.g. when building for 10.9 legacy builds, we could be using an Xcode version that's too new for that) when building gettext/libsodium. This is compounded by the fact that our GitHub Action cache key for the libraries only include the formula, but not the active Xcode version itself so a cache could be propagated for a while until suddenly things break. To fix this, first make sure we do Xcode configuration early on in the build, and to properly use the Xcode version as part of the cache key. This way, when Xcode version changes, we will invalidate the cache and rebuild gettext / libsodium with the correct configuration and if that's wrong we will immediately fail the build instead of using old stale caches. Also, bump Xcode from 14.1 to 14.2 in CI.
1 parent 462d89c commit 86af12a

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.github/actions/universal-package/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ runs:
1111
using: 'composite'
1212
steps:
1313
- name: Set up formula
14+
id: setup-formula
1415
shell: bash
1516
run: |
1617
echo '::group::Set up formula'
@@ -23,14 +24,19 @@ runs:
2324
2425
# Uninstall the already installed formula because we want to build our own
2526
brew uninstall --ignore-dependencies ${formula} || true
27+
28+
# Extract Xcode version to serve as part of the key for caching
29+
xcode_version=$(xcodebuild -version | tail -1 | sed -E 's/Build version (.*)/\1/')
30+
echo "xcode_version=$xcode_version" >> $GITHUB_OUTPUT
31+
2632
echo '::endgroup::'
2733
2834
- name: Cache keg
2935
id: cache-keg
3036
uses: actions/cache@v3
3137
with:
3238
path: /usr/local/Cellar/${{ inputs.formula }}
33-
key: ${{ inputs.formula }}-homebrew-cache-patched-unified-${{ hashFiles(format('{0}.rb', inputs.formula)) }}
39+
key: ${{ inputs.formula }}-homebrew-cache-patched-unified-xcode${{ steps.setup-formula.outputs.xcode_version }}-${{ hashFiles(format('{0}.rb', inputs.formula)) }}
3440

3541
- name: Install formula
3642
shell: bash

.github/workflows/ci-macvim.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262

6363
# Most up to date OS and Xcode. Used to publish release for the main build.
6464
- os: macos-12
65-
xcode: '14.1'
65+
xcode: '14.2'
6666
publish: true
6767

6868
runs-on: ${{ matrix.os }}
@@ -82,6 +82,13 @@ jobs:
8282
# Later, we pass the --enable-sparkle_1 flag to configure to set the corresponding ifdef.
8383
ln -fhs Sparkle_1.framework src/MacVim/Sparkle.framework
8484
85+
- name: Set up Xcode
86+
if: matrix.xcode != ''
87+
run: |
88+
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
89+
xcode-select -p
90+
xcodebuild -version
91+
8592
# Set up, install, and cache gettext library for localization.
8693
#
8794
# Instead of using the default binary installed by Homebrew, need to build our own because gettext is statically
@@ -131,12 +138,6 @@ jobs:
131138
brew unlink perl
132139
fi
133140
134-
- name: Set up Xcode
135-
if: matrix.xcode != ''
136-
run: |
137-
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
138-
xcode-select -p
139-
140141
# All set up steps are done. Build and test MacVim below.
141142

142143
- name: Configure

0 commit comments

Comments
 (0)