Skip to content

Commit c368ebb

Browse files
authored
Merge pull request #1444 from ychin/enable-ci-link-time-optimization-2
Use -O3 and link-time-optimization for published builds
2 parents 35f8af5 + aff7a2f commit c368ebb

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

.github/workflows/ci-macvim.yaml

+24-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ env:
2020

2121
CC: clang
2222

23+
MAKE_BUILD_ARGS: LINK_AS_NEEDED=yes # In macOS we never over-specify link dependencies and we already check against external deps in smoketest. With LTO, linking takes a while, so we want to avoid using link.sh.
24+
2325
VERSIONER_PERL_VERSION: '5.30' # macOS default Perl installation uses this to determine which one to use
2426

2527
vi_cv_path_python: /Library/Frameworks/Python.framework/Versions/2.7/bin/python
@@ -186,6 +188,13 @@ jobs:
186188
sed -i.bak -f ci/config.mk.clang-12.sed src/auto/config.mk
187189
fi
188190
191+
if ${{ matrix.publish == true && ! matrix.legacy }}; then
192+
# Only do O3/link-time optimizations for publish builds, so the other ones can still finish quickly to give
193+
# quick feedbacks. Only do this for non-legacy builds now as it seems the older toolchain doesn't work as
194+
# well for this.
195+
sed -i.bak -f ci/config.mk.optimized.sed src/auto/config.mk
196+
fi
197+
189198
- name: Modify configure result
190199
if: matrix.publish
191200
run: |
@@ -211,12 +220,11 @@ jobs:
211220
env:
212221
LC_ALL: C
213222
run: |
214-
set -o verbose
215-
216223
NPROC=$(getconf _NPROCESSORS_ONLN)
217224
echo "Building MacVim with ${NPROC} cores"
218225
219-
make -j${NPROC}
226+
set -o verbose
227+
make ${MAKE_BUILD_ARGS} -j${NPROC}
220228
221229
- name: Check version
222230
run: |
@@ -292,15 +300,25 @@ jobs:
292300
make -C runtime/doc vimtags VIMEXE=../../${VIM_BIN}
293301
git diff --exit-code -- runtime/doc/tags
294302
303+
- name: Build test binaries
304+
run: |
305+
# Build the unit test binaries first. With link-time-optimization they take some time to link. Running them
306+
# separately de-couples them from the timeout in tests, and allow us to build in parallel jobs (since tests
307+
# can't run in parallel).
308+
NPROC=$(getconf _NPROCESSORS_ONLN)
309+
310+
set -o verbose
311+
make ${MAKE_BUILD_ARGS} -j${NPROC} -C src unittesttargets
312+
295313
- name: Test
296314
timeout-minutes: 20
297-
run: make test
315+
run: make ${MAKE_BUILD_ARGS} test
298316

299317
- name: Test GUI
300318
timeout-minutes: 20
301319
run: |
302-
make -C src/testdir clean
303-
make -C src testgui
320+
make ${MAKE_BUILD_ARGS} -C src/testdir clean
321+
make ${MAKE_BUILD_ARGS} -C src testgui
304322
305323
# Creates a DMG package of MacVim. Note that this doesn't create a GitHub release for us, because we would prefer to
306324
# do it manually, for two reasons: 1) signing / notarization are currently done out of CI, 2) we want to manually

ci/config.mk.optimized.sed

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Add link-time optimization for even better performance
2+
/^CFLAGS[[:blank:]]*=/s/-O2/-O3 -flto/
3+
/^LDFLAGS[[:blank:]]*=/s/$/ -flto/

0 commit comments

Comments
 (0)