|
| 1 | +name: VFS for Git Functional Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ vfs-*, tentative/vfs-* ] |
| 6 | + pull_request: |
| 7 | + branches: [ vfs-*, features/* ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + actions: read |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ${{ matrix.architecture == 'aarch64' && 'windows-11-arm' || 'windows-2022' }} |
| 16 | + name: Build Git (${{ matrix.architecture }}) |
| 17 | + |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + architecture: [ x86_64, aarch64 ] |
| 21 | + fail-fast: false |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Check out Git's source code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Setup build tools |
| 28 | + uses: git-for-windows/setup-git-for-windows-sdk@v1 |
| 29 | + with: |
| 30 | + architecture: ${{ matrix.architecture }} |
| 31 | + |
| 32 | + - name: Provide a minimal `install` |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + test -x /usr/bin/install || |
| 36 | + tr % '\t' >/usr/bin/install <<-\EOF |
| 37 | + #!/bin/sh |
| 38 | +
|
| 39 | + cmd=cp |
| 40 | + while test $# != 0 |
| 41 | + do |
| 42 | + %case "$1" in |
| 43 | + %-d) cmd="mkdir -p";; |
| 44 | + %-m) shift;; # ignore mode |
| 45 | + %*) break;; |
| 46 | + %esac |
| 47 | + %shift |
| 48 | + done |
| 49 | +
|
| 50 | + exec $cmd "$@" |
| 51 | + EOF |
| 52 | +
|
| 53 | + - name: Build and install Git |
| 54 | + shell: bash |
| 55 | + env: |
| 56 | + NO_TCLTK: Yup |
| 57 | + run: | |
| 58 | + # We do require a VFS version |
| 59 | + def_ver="$(sed -n 's/DEF_VER=\(.*vfs.*\)/\1/p' GIT-VERSION-GEN)" |
| 60 | + test -n "$def_ver" |
| 61 | +
|
| 62 | + # Ensure that `git version` reflects DEF_VER |
| 63 | + case "$(git describe --match "v[0-9]*vfs*" HEAD)" in |
| 64 | + ${def_ver%%.vfs.*}.vfs.*) ;; # okay, we can use this |
| 65 | + *) git -c user.name=ci -c user.email=ci@github tag -m for-testing ${def_ver}.NNN.g$(git rev-parse --short HEAD);; |
| 66 | + esac |
| 67 | +
|
| 68 | + make -j5 DESTDIR="$GITHUB_WORKSPACE/MicrosoftGit/payload/${{ matrix.architecture }}" install |
| 69 | +
|
| 70 | + - name: Upload Git artifact |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: MicrosoftGit-${{ matrix.architecture }} |
| 74 | + path: MicrosoftGit |
| 75 | + |
| 76 | + package: |
| 77 | + runs-on: windows-2022 |
| 78 | + name: Package Git |
| 79 | + needs: build |
| 80 | + |
| 81 | + outputs: |
| 82 | + vfs_run_id: ${{ steps.find_run.outputs.run_id }} |
| 83 | + |
| 84 | + steps: |
| 85 | + - name: Download x86_64 build |
| 86 | + uses: actions/download-artifact@v4 |
| 87 | + with: |
| 88 | + name: MicrosoftGit-x86_64 |
| 89 | + path: MicrosoftGit |
| 90 | + |
| 91 | + - name: Download aarch64 build |
| 92 | + uses: actions/download-artifact@v4 |
| 93 | + with: |
| 94 | + name: MicrosoftGit-aarch64 |
| 95 | + path: MicrosoftGit |
| 96 | + |
| 97 | + - name: Create install script |
| 98 | + shell: bash |
| 99 | + run: | |
| 100 | + cat >"$GITHUB_WORKSPACE/MicrosoftGit/install.bat" <<'BATCH' |
| 101 | + @echo off |
| 102 | + if "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( |
| 103 | + set GIT_PAYLOAD=%~dp0payload\aarch64 |
| 104 | + ) else ( |
| 105 | + set GIT_PAYLOAD=%~dp0payload\x86_64 |
| 106 | + ) |
| 107 | + echo Installing Git from %GIT_PAYLOAD% to "C:\Program Files\Git"... |
| 108 | + robocopy "%GIT_PAYLOAD%" "C:\Program Files\Git" /E /NFL /NDL /NJH /NJS /NS /NC |
| 109 | + if %ERRORLEVEL% GEQ 8 exit /b %ERRORLEVEL% |
| 110 | + echo C:\Program Files\Git\cmd>>"%GITHUB_PATH%" |
| 111 | + exit /b 0 |
| 112 | + BATCH |
| 113 | +
|
| 114 | + - name: Upload Git artifact |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: MicrosoftGit |
| 118 | + path: MicrosoftGit |
| 119 | + |
| 120 | + - name: Find latest VFSForGit build |
| 121 | + id: find_run |
| 122 | + shell: bash |
| 123 | + env: |
| 124 | + GH_TOKEN: ${{ github.token }} |
| 125 | + run: | |
| 126 | + run_id=$(gh run list \ |
| 127 | + --repo microsoft/VFSForGit \ |
| 128 | + --workflow build.yaml \ |
| 129 | + --branch master \ |
| 130 | + --status success \ |
| 131 | + --limit 1 \ |
| 132 | + --json databaseId \ |
| 133 | + -q '.[0].databaseId') |
| 134 | + test -n "$run_id" || { echo "::error::No successful VFSForGit build found"; exit 1; } |
| 135 | +
|
| 136 | + # If the run was skipped, follow the annotation to the real run. |
| 137 | + # The skip notice may only appear on a re-attempt, so check |
| 138 | + # attempts from latest to first. |
| 139 | + attempts=$(gh api "repos/microsoft/VFSForGit/actions/runs/$run_id" \ |
| 140 | + --jq '.run_attempt') |
| 141 | + for attempt in $(seq "$attempts" -1 1); do |
| 142 | + job_id=$(gh api "repos/microsoft/VFSForGit/actions/runs/$run_id/attempts/$attempt/jobs" \ |
| 143 | + --jq '.jobs[] | select(.name == "Validation") | .id') |
| 144 | + test -n "$job_id" || continue |
| 145 | + skip_msg=$(gh api "repos/microsoft/VFSForGit/check-runs/$job_id/annotations" \ |
| 146 | + --jq '[.[] | select(.message | startswith("Skipping:"))][0].message // empty') |
| 147 | + test -n "$skip_msg" || continue |
| 148 | + real_id=$(echo "$skip_msg" | sed -n 's|.*/runs/\([0-9]*\).*|\1|p') |
| 149 | + if [ -n "$real_id" ] && [ "$real_id" != "$run_id" ]; then |
| 150 | + echo "::notice::Skipped run $run_id (attempt $attempt), following to real run $real_id" |
| 151 | + run_id=$real_id |
| 152 | + fi |
| 153 | + break |
| 154 | + done |
| 155 | +
|
| 156 | + echo "run_id=$run_id" >> "$GITHUB_OUTPUT" |
| 157 | + echo ::notice::Using VFSForGit build with run_id=$run_id |
| 158 | +
|
| 159 | + functional_tests: |
| 160 | + name: Functional Tests |
| 161 | + needs: package |
| 162 | + uses: microsoft/VFSForGit/.github/workflows/functional-tests.yaml@master |
| 163 | + with: |
| 164 | + vfs_run_id: ${{ needs.package.outputs.vfs_run_id }} |
0 commit comments