Installer: detect manually-configured default branch #302
Workflow file for this run
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
name: PR build | |
on: pull_request | |
env: | |
GIT_CONFIG_PARAMETERS: "'checkout.workers=56'" | |
jobs: | |
determine-packages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: determine packages to build | |
id: set-matrix | |
shell: bash | |
run: | | |
define_matrix () { | |
comm -12 "$2" "$3" >"$4" && | |
cat "$4" && | |
sed -e 's/\/$//' -e 's/.*/"&", /' -e '$s/, $//' <"$4" >list.txt && | |
echo "$1=[$(test ! -s list.txt && echo '""' || tr -d '\n' <list.txt)]" >>$GITHUB_OUTPUT | |
} | |
git diff ${{github.event.pull_request.base.sha}}... --name-only | | |
sed \ | |
-e '/^make-file-list\.sh$/ainstaller/' \ | |
-e '/^make-file-list\.sh$/aportable/' \ | |
-e '/^make-file-list\.sh$/amingit/' \ | |
-e 's|[^/]*$||' | | |
sort -u >touched.txt && | |
git ls-files \*/PKGBUILD | sed 's|[^/]*$||' | sort >directories.txt && | |
define_matrix matrix directories.txt touched.txt packages.txt && | |
git ls-files \*/release.sh | sed 's|[^/]*$||' | sort >releaseable.txt && | |
define_matrix artifacts releaseable.txt touched.txt artifacts.txt | |
test -z "$(git log -L :create_sdk_artifact:please.sh ${{github.event.pull_request.base.sha}}.. -- )" && | |
test 200 -gt $(git diff --numstat ${{github.event.pull_request.base.sha}}.. -- please.sh | cut -f 2) && | |
test -z "$(git diff ${{github.event.pull_request.base.sha}}.. -- make-file-list.sh)" || | |
echo "test-sdk-artifacts=true" >>$GITHUB_OUTPUT | |
test -z "$(git diff ${{github.event.pull_request.base.sha}}.. -- check-for-missing-dlls.sh)" || | |
echo "check-for-missing-dlls=true" >>$GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
artifacts: ${{ steps.set-matrix.outputs.artifacts }} | |
test-sdk-artifacts: ${{ steps.set-matrix.outputs.test-sdk-artifacts }} | |
check-for-missing-dlls: ${{ steps.set-matrix.outputs.check-for-missing-dlls }} | |
build-packages: | |
needs: determine-packages | |
runs-on: windows-latest | |
if: needs.determine-packages.outputs.matrix != '[""]' | |
strategy: | |
fail-fast: false | |
matrix: | |
directory: ${{ fromJSON(needs.determine-packages.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: git-for-windows/setup-git-for-windows-sdk@v1 | |
with: | |
flavor: full | |
- name: build ${{ matrix.directory }} | |
shell: bash | |
run: | | |
top_dir=$PWD && | |
cd "${{ matrix.directory }}" && | |
MAKEFLAGS=-j8 makepkg-mingw -s --noconfirm && | |
artifacts="$(basename "${{ matrix.directory }}")-artifacts" && | |
mkdir -p "$top_dir/$artifacts" && | |
mv *.tar.* "$top_dir/$artifacts"/ && | |
echo "artifacts=$artifacts" >>$GITHUB_ENV | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.artifacts }} | |
path: ${{ env.artifacts }} | |
- name: ensure that the Git worktree is still clean | |
shell: bash | |
run: | | |
cd "${{ matrix.directory }}" && | |
if ! git update-index --ignore-submodules --refresh || | |
! git diff-files --ignore-submodules || | |
! git diff-index --cached --ignore-submodules HEAD | |
then | |
echo "::error::Uncommitted changes after build!" >&2 | |
git diff | |
exit 1 | |
fi | |
build-artifacts: | |
needs: determine-packages | |
runs-on: windows-latest | |
if: needs.determine-packages.outputs.artifacts != '[""]' | |
strategy: | |
fail-fast: false | |
matrix: | |
directory: ${{ fromJSON(needs.determine-packages.outputs.artifacts) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: initialize bare SDK clone | |
shell: bash | |
run: | | |
git clone --bare --depth=1 --single-branch --branch=main --filter=blob:none \ | |
https://github.com/git-for-windows/git-sdk-64 .sdk | |
- name: build build-installers-64 artifact | |
shell: bash | |
run: | | |
./please.sh create-sdk-artifact \ | |
--bitness=64 \ | |
--sdk=.sdk \ | |
--out=sdk-artifact \ | |
build-installers && | |
cygpath -aw "$PWD/sdk-artifact/usr/bin/core_perl" >>$GITHUB_PATH && | |
cygpath -aw "$PWD/sdk-artifact/usr/bin" >>$GITHUB_PATH && | |
cygpath -aw "$PWD/sdk-artifact/mingw64/bin" >>$GITHUB_PATH && | |
echo "MSYSTEM=MINGW64" >>$GITHUB_ENV | |
- name: build ${{ matrix.directory }}/ | |
shell: bash | |
run: | | |
artifacts="$(basename "${{ matrix.directory }}")-artifacts" && | |
mkdir -p "$artifacts" && | |
./"${{ matrix.directory }}"/release.sh --output="$PWD/$artifacts/" 0-test && | |
echo "artifacts=$artifacts" >>$GITHUB_ENV | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.artifacts }} | |
path: ${{ env.artifacts }} | |
sdk-artifacts: | |
needs: determine-packages | |
if: needs.determine-packages.outputs.test-sdk-artifacts == 'true' | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
artifact: ['minimal', 'makepkg-git', 'build-installers', 'full'] | |
bitness: ['32', '64'] | |
exclude: | |
- artifact: minimal | |
bitness: 32 | |
- artifact: makepkg-git | |
bitness: 32 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: initialize bare SDK clone | |
shell: bash | |
run: | | |
case "${{ matrix.artifact }}" in | |
full) partial=;; | |
*) partial=--filter=blob:none;; | |
esac && | |
git clone --bare --depth=1 --single-branch --branch=main $partial \ | |
https://github.com/git-for-windows/git-sdk-${{ matrix.bitness }} .sdk | |
- name: build ${{ matrix.artifact }} artifact | |
shell: bash | |
run: | | |
case "${{ matrix.artifact }}" in | |
full) | |
git --git-dir=.sdk worktree add --detach sdk-artifact | |
;; | |
*) | |
./please.sh create-sdk-artifact \ | |
--bitness=${{ matrix.bitness }} \ | |
--sdk=.sdk \ | |
--out=sdk-artifact \ | |
${{ matrix.artifact }} | |
;; | |
esac && | |
cygpath -aw "$PWD/sdk-artifact/usr/bin/core_perl" >>$GITHUB_PATH && | |
cygpath -aw "$PWD/sdk-artifact/usr/bin" >>$GITHUB_PATH && | |
cygpath -aw "$PWD/sdk-artifact/mingw${{ matrix.bitness }}/bin" >>$GITHUB_PATH && | |
echo "MSYSTEM=MINGW${{ matrix.bitness }}" >>$GITHUB_ENV | |
- name: build installer | |
if: matrix.artifact == 'build-installers' | |
shell: bash | |
run: ./installer/release.sh --output=$PWD/installer-${{ matrix.bitness }} 0-test | |
- uses: actions/upload-artifact@v3 | |
if: matrix.artifact == 'build-installers' | |
with: | |
name: installer-${{ matrix.bitness }} | |
path: installer-${{ matrix.bitness }} | |
- name: run the installer | |
if: matrix.artifact == 'build-installers' | |
shell: pwsh | |
run: | | |
$exePath = Get-ChildItem -Path installer-${{ matrix.bitness }}/*.exe | %{$_.FullName} | |
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1 /LOG=installer.log" | |
"$env:ProgramFiles\Git\usr\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH | |
"$env:ProgramFiles\Git\mingw${{env.ARCH_BITNESS}}\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH | |
- name: validate | |
if: matrix.artifact == 'build-installers' | |
shell: bash | |
run: | | |
set -x && | |
cygpath -aw / && | |
git.exe version --build-options >version && | |
cat version && | |
grep "$(sed -e 's|^v||' -e 's|-|.|g' <bundle-artifacts/next_version)" version && | |
checklist=installer/run-checklist.sh && | |
# cannot test SSH keys in read-only mode, skip test for now | |
sed -i 's|[email protected]:v3/git-for-windows/git/git|https://github.com/git/git|' $checklist && | |
sh -x $checklist | |
check-for-missing-dlls: | |
needs: determine-packages | |
if: needs.determine-packages.outputs.test-sdk-artifacts == 'true' || needs.determine-packages.outputs.check-for-missing-dlls == 'true' | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
bitness: ['32', '64'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: initialize bare SDK clone | |
shell: bash | |
run: | | |
git clone --bare --depth=1 --single-branch --branch=main --filter=blob:none \ | |
https://github.com/git-for-windows/git-sdk-${{ matrix.bitness }} .sdk | |
- name: build build-installers-${{ matrix.bitness }} artifact | |
shell: bash | |
run: | | |
INCLUDE_OBJDUMP=t \ | |
./please.sh create-sdk-artifact \ | |
--bitness=${{ matrix.bitness }} \ | |
--sdk=.sdk \ | |
--out=sdk-artifact \ | |
build-installers && | |
cygpath -aw "$PWD/sdk-artifact/usr/bin/core_perl" >>$GITHUB_PATH && | |
cygpath -aw "$PWD/sdk-artifact/usr/bin" >>$GITHUB_PATH && | |
cygpath -aw "$PWD/sdk-artifact/mingw${{ matrix.bitness }}/bin" >>$GITHUB_PATH && | |
echo "MSYSTEM=MINGW${{ matrix.bitness }}" >>$GITHUB_ENV | |
- name: check for missing DLLs | |
shell: bash | |
run: ./check-for-missing-dlls.sh | |
- name: check for missing DLLs (MinGit) | |
shell: bash | |
run: MINIMAL_GIT=1 ./check-for-missing-dlls.sh |