WIP: Add workflow for git testing #25
This file contains hidden or 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: Build and test git | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| git_branch: | |
| description: 'Git branch to build' | |
| required: false | |
| default: 'v2.47.1' | |
| git_revision: | |
| description: 'Git for Windows revision to build' | |
| required: false | |
| default: 'windows.2' | |
| env: | |
| GIT_REPO: git/git | |
| GIT_BRANCH: ${{ github.event.inputs.git_branch || 'v2.47.1' }} | |
| GIT_REVISION: ${{ github.event.inputs.git_revision || 'windows.2' }} | |
| jobs: | |
| build-and-test-git: | |
| name: Build and test git | |
| runs-on: ${{ matrix.platform == 'w64-mingw32' && 'windows-latest' || 'ubuntu-latest' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [aarch64, x86_64] | |
| platform: [w64-mingw32, pc-linux-gnu, pc-cygwin] | |
| exclude: | |
| - arch: aarch64 | |
| - platform: pc-cygwin | |
| defaults: | |
| run: | |
| shell: ${{ env.PLATFORM == 'pc-linux-gnu' && 'bash' || 'D:/git-sdk-64-full/usr/bin/git-bash.exe --noprofile --norc -e -o pipefail {0}' }} | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| PLATFORM: ${{ matrix.platform }} | |
| TARGET: ${{ matrix.arch }}-${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Git for Windows SDK | |
| if: ${{ env.PLATFORM == 'w64-mingw32' }} | |
| uses: git-for-windows/setup-git-for-windows-sdk@v1 | |
| with: | |
| flavor: full | |
| - name: Checkout git repository (pc-linux-gnu) | |
| if: ${{ env.PLATFORM == 'pc-linux-gnu' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.GIT_REPO }} | |
| ref: ${{ env.GIT_BRANCH }} | |
| path: git | |
| - name: Checkout git repository (w64-mingw32) | |
| if: ${{ env.PLATFORM == 'w64-mingw32' }} | |
| working-directory: / | |
| run: | | |
| /git-bash.exe -c sdk init git | |
| cd /usr/src/git | |
| git fetch --all | |
| git checkout ${{ env.GIT_BRANCH }}.${{ env.GIT_REVISION }} | |
| - name: Install dependencies | |
| if: ${{ env.PLATFORM == 'pc-linux-gnu' }} | |
| run: | | |
| .github/scripts/git/install-dependencies.sh | |
| - name: Build ${{ env.TARGET }} git | |
| working-directory: ${{ env.PLATFORM == 'pc-linux-gnu' && 'git' || '/usr/src/git' }} | |
| run: | | |
| make -j$(nproc) | |
| - name: Test ${{ env.TARGET }} git | |
| working-directory: ${{ env.PLATFORM == 'pc-linux-gnu' && 'git' || '/usr/src/git' }} | |
| run: | | |
| make \ | |
| DEFAULT_TEST_TARGET=prove \ | |
| GIT_PROVE_OPTS='--timer --jobs $(nproc) --state=failed,save' \ | |
| test |