Skip to content

Commit 4e29e60

Browse files
vdyedscho
authored andcommitted
Merge pull request #472 from vdye/ms/macos-build-options
Fixes for MacOS release build & build options
2 parents 070cffc + 7363256 commit 4e29e60

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

.github/macos-installer/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GIT_PREFIX := $(PREFIX)/git
2121
BUILD_DIR := $(GITHUB_WORKSPACE)/payload
2222
DESTDIR := $(PWD)/stage/git-$(ARCH_UNIV)-$(VERSION)
2323
ARTIFACTDIR := build-artifacts
24-
SUBMAKE := $(MAKE) C_INCLUDE_PATH="$(C_INCLUDE_PATH)" CPLUS_INCLUDE_PATH="$(CPLUS_INCLUDE_PATH)" LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" TARGET_FLAGS="$(TARGET_FLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" NO_GETTEXT=1 NO_DARWIN_PORTS=1 prefix=$(GIT_PREFIX) DESTDIR=$(DESTDIR)
24+
SUBMAKE := $(MAKE) C_INCLUDE_PATH="$(C_INCLUDE_PATH)" CPLUS_INCLUDE_PATH="$(CPLUS_INCLUDE_PATH)" LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" TARGET_FLAGS="$(TARGET_FLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" NO_GETTEXT=1 NO_DARWIN_PORTS=1 prefix=$(GIT_PREFIX) GIT_BUILT_FROM_COMMIT="$(GIT_BUILT_FROM_COMMIT)" DESTDIR=$(DESTDIR)
2525
CORES := $(shell bash -c "sysctl hw.ncpu | awk '{print \$$2}'")
2626

2727
# Guard against environment variables

.github/workflows/build-git-installers.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ jobs:
446446
447447
make -C git -j$(sysctl -n hw.physicalcpu) GIT-VERSION-FILE dist dist-doc
448448
449+
export GIT_BUILT_FROM_COMMIT=$(gunzip -c git/git-$VERSION.tar.gz | git get-tar-commit-id) ||
450+
die "Could not determine commit for build"
451+
449452
# Extract tarballs
450453
mkdir payload manpages
451454
tar -xvf git/git-$VERSION.tar.gz -C payload
@@ -635,12 +638,83 @@ jobs:
635638
*.deb
636639
# End build and sign Debian package
637640

641+
# Validate installers
642+
validate-installers:
643+
name: Validate installers
644+
strategy:
645+
matrix:
646+
component:
647+
- os: ubuntu-latest
648+
artifact: linux-artifacts
649+
command: git
650+
- os: macos-latest-xl-arm64
651+
artifact: macos-artifacts
652+
command: git
653+
- os: macos-latest
654+
artifact: macos-artifacts
655+
command: git
656+
- os: windows-latest
657+
artifact: win-installer-x86_64
658+
command: $PROGRAMFILES\Git\cmd\git.exe
659+
- os: ['self-hosted', '1ES.Pool=github-arm64-pool']
660+
artifact: win-installer-aarch64
661+
command: $PROGRAMFILES\Git\cmd\git.exe
662+
runs-on: ${{ matrix.component.os }}
663+
needs: [prereqs, windows_artifacts, create-macos-artifacts, create-linux-artifacts]
664+
steps:
665+
- name: Download artifacts
666+
uses: actions/download-artifact@v4
667+
with:
668+
name: ${{ matrix.component.artifact }}
669+
670+
- name: Install Windows
671+
if: contains(matrix.component.artifact, 'win-installer')
672+
shell: pwsh
673+
run: |
674+
$exePath = Get-ChildItem -Path ./*.exe | %{$_.FullName}
675+
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1"
676+
677+
- name: Install Linux
678+
if: contains(matrix.component.artifact, 'linux')
679+
run: |
680+
debpath=$(find ./*.deb)
681+
sudo apt install $debpath
682+
683+
- name: Install macOS
684+
if: contains(matrix.component.artifact, 'macos')
685+
run: |
686+
# avoid letting Homebrew's `git` in `/opt/homebrew/bin` override `/usr/local/bin/git`
687+
arch="$(uname -m)"
688+
test arm64 != "$arch" ||
689+
brew uninstall git
690+
691+
pkgpath=$(find ./*universal*.pkg)
692+
sudo installer -pkg $pkgpath -target /
693+
694+
- name: Validate
695+
shell: bash
696+
run: |
697+
"${{ matrix.component.command }}" --version | sed 's/git version //' >actual
698+
echo ${{ needs.prereqs.outputs.tag_version }} >expect
699+
cmp expect actual || exit 1
700+
701+
- name: Validate universal binary CPU architecture
702+
if: contains(matrix.component.os, 'macos')
703+
shell: bash
704+
run: |
705+
set -ex
706+
git version --build-options >actual
707+
cat actual
708+
grep "cpu: $(uname -m)" actual
709+
# End validate installers
710+
638711
create-github-release:
639712
runs-on: ubuntu-latest
640713
permissions:
641714
contents: write
642715
id-token: write # required for Azure login via OIDC
643716
needs:
717+
- validate-installers
644718
- create-linux-artifacts
645719
- create-macos-artifacts
646720
- windows_artifacts

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3707,7 +3707,7 @@ dist: git-archive$(X) configure
37073707
@$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
37083708
./git-archive --format=tar \
37093709
$(GIT_ARCHIVE_EXTRA_FILES) \
3710-
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
3710+
--prefix=$(GIT_TARNAME)/ HEAD > $(GIT_TARNAME).tar
37113711
@$(RM) -r .dist-tmp-dir
37123712
gzip -f -9 $(GIT_TARNAME).tar
37133713

0 commit comments

Comments
 (0)