Test a specific MSYS2 runtime version #8
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: test-msys2-runtime | |
run-name: Test a specific MSYS2 runtime version | |
on: | |
workflow_dispatch: | |
inputs: | |
msys2-runtime-artifacts-url: | |
# e.g. https://github.com/msys2/msys2-runtime/actions/runs/7865269712/artifacts/1236989688 | |
description: The URL to the artifacts of an msys2-runtime build | |
type: string | |
push: | |
env: | |
LC_CTYPE: C.UTF-8 | |
MSYS2_RUNTIME_ARTIFACT_URL: ${{ inputs.msys2-runtime-artifacts-url || 'https://github.com/msys2/msys2-runtime/actions/runs/7865269712/artifacts/1236989688' }} | |
G4W_SDK_REPO: git-for-windows/git-sdk-64 | |
jobs: | |
minimal-sdk-artifact: | |
runs-on: windows-latest | |
steps: | |
- name: get latest successful ci-artifacts run | |
id: ci-artifacts-run-id | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const [ owner, repo ] = process.env.G4W_SDK_REPO.split('/') | |
const info = await github.rest.actions.listWorkflowRuns({ | |
owner, | |
repo, | |
workflow_id: 938271, // ci-artifacts.yml | |
status: 'success', | |
per_page: 1 | |
}) | |
return info.data.workflow_runs[0].id | |
- name: get the ci-artifacts build's artifacts | |
shell: bash | |
run: | | |
run_id=${{ steps.ci-artifacts-run-id.outputs.result }} && | |
curl -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \ | |
-L https://api.github.com/repos/$G4W_SDK_REPO/actions/runs/$run_id/artifacts | | |
jq -r '.artifacts[] | [.name, .archive_download_url] | @tsv' | | |
tr -d '\r' | | |
while read name url | |
do | |
echo "$name" | |
curl -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \ | |
-#sLo /tmp/"$name".zip "$url" && | |
unzip -q /tmp/"$name".zip || | |
exit $? | |
done | |
- name: overwrite MSYS2 runtime with the msys2-runtime build's artifacts | |
shell: bash | |
run: | | |
set -x && | |
case "$MSYS2_RUNTIME_ARTIFACT_URL" in | |
https://github.com/*/actions/runs/[0-9]*/artifacts/[0-9]*) | |
MSYS2_RUNTIME_ARTIFACT_URL="$(echo "$MSYS2_RUNTIME_ARTIFACT_URL" | | |
sed 's|^\(https://\)\(github.com/\)\(.*/actions/\)runs/[0-9]*/\(artifacts/[0-9]*\)$|\1api.\2repos/\3\4/zip|')" | |
;; | |
esac | |
curl -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \ | |
-fLo msys2-runtime.zip "$MSYS2_RUNTIME_ARTIFACT_URL" && | |
mkdir minimal-sdk && | |
cd minimal-sdk && | |
tar xzf ../git-sdk-64-minimal.tar.gz && | |
unzip -qo ../msys2-runtime.zip && | |
tar cvf - * .[0-9A-Za-z]* | gzip -1 >../git-sdk-64-minimal.tar.gz | |
- name: run `uname` | |
run: minimal-sdk\usr\bin\uname.exe -a | |
- name: adjust absolute paths in bin-wrappers/* | |
shell: bash | |
run: | | |
tar xf git-artifacts.tar.gz && | |
from="$(sed -n 's|^GIT_EXEC_PATH='\''\(.*/git\)'\''$|\1|p' git/bin-wrappers/git)" && | |
to="$(cygpath -au ../git)" && | |
sed -i "s|$from|$to|g" git/bin-wrappers/* && | |
tar czf git-artifacts.tar.gz git | |
- name: upload minimal-sdk artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: minimal-sdk | |
path: git-sdk-64-minimal.tar.gz | |
- name: upload git artifacts for testing | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-artifacts | |
path: git-artifacts.tar.gz | |
test-minimal-sdk: | |
runs-on: windows-latest | |
needs: [minimal-sdk-artifact] | |
strategy: | |
matrix: | |
# 0..16 permuted according to the matrix builds' timings as of git/git@9fadedd63 | |
nr: [9] | |
steps: | |
- uses: mxschmitt/action-tmate@v3 | |
with: | |
detached: true | |
- name: download minimal-sdk artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: minimal-sdk | |
path: ${{github.workspace}} | |
- name: uncompress minimal-sdk | |
shell: bash | |
run: | | |
mkdir -p minimal-sdk && | |
tar -C minimal-sdk -xzf git-sdk-64-minimal.tar.gz && | |
minimal-sdk/init.sh | |
- name: download git artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: git-artifacts | |
path: ${{github.workspace}} | |
- name: uncompress git-artifacts | |
shell: bash | |
run: tar -C .. -xzf git-artifacts.tar.gz | |
- name: test | |
shell: bash | |
run: | | |
set -x | |
test "$(cygpath -aw /)" = "${{github.workspace}}\minimal-sdk" || exit 1 | |
cd ../git/t && | |
make T="$(ls -S t[0-9]*.sh | awk '!((NR+${{matrix.nr}})%17)' | tr '\n' \ )" prove || { | |
for d in trash* | |
do | |
t=${d#trash directory.} | |
echo =========================== | |
echo Failed: $t.sh | |
cat test-results/$t.out | |
done | |
exit 1 | |
} | |
env: | |
PATH: ${{github.workspace}}\minimal-sdk\mingw64\bin;${{github.workspace}}\minimal-sdk\usr\bin;${{github.workspace}}\minimal-sdk\usr\bin\core_perl;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem | |
GIT_TEST_OPTS: --verbose-log -x --no-chain-lint | |
GIT_PROVE_OPTS: --timer --jobs 8 | |
NO_SVN_TESTS: 1 |