mirror of
https://github.com/git/git.git
synced 2024-10-28 04:49:43 +01:00
Merge branch 'ps/ci-gitlab-windows'
Enable Windows-based CI in GitLab. * ps/ci-gitlab-windows: gitlab-ci: exercise Git on Windows gitlab-ci: introduce stages and dependencies ci: handle Windows-based CI jobs in GitLab CI ci: create script to set up Git for Windows SDK t7300: work around platform-specific behaviour with long paths on MinGW
This commit is contained in:
commit
55bc7d54ab
5 changed files with 87 additions and 12 deletions
16
.github/workflows/main.yml
vendored
16
.github/workflows/main.yml
vendored
|
@ -113,13 +113,15 @@ jobs:
|
||||||
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
|
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
- name: setup SDK
|
||||||
|
shell: powershell
|
||||||
|
run: ci/install-sdk.ps1
|
||||||
- name: build
|
- name: build
|
||||||
shell: bash
|
shell: powershell
|
||||||
env:
|
env:
|
||||||
HOME: ${{runner.workspace}}
|
HOME: ${{runner.workspace}}
|
||||||
NO_PERL: 1
|
NO_PERL: 1
|
||||||
run: . /etc/profile && ci/make-test-artifacts.sh artifacts
|
run: git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts'
|
||||||
- name: zip up tracked files
|
- name: zip up tracked files
|
||||||
run: git archive -o artifacts/tracked.tar.gz HEAD
|
run: git archive -o artifacts/tracked.tar.gz HEAD
|
||||||
- name: upload tracked files and build artifacts
|
- name: upload tracked files and build artifacts
|
||||||
|
@ -147,10 +149,12 @@ jobs:
|
||||||
- name: extract tracked files and build artifacts
|
- name: extract tracked files and build artifacts
|
||||||
shell: bash
|
shell: bash
|
||||||
run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
|
run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
|
||||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
- name: setup SDK
|
||||||
|
shell: powershell
|
||||||
|
run: ci/install-sdk.ps1
|
||||||
- name: test
|
- name: test
|
||||||
shell: bash
|
shell: powershell
|
||||||
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
|
run: git-sdk/usr/bin/bash.exe -l -c 'ci/run-test-slice.sh ${{matrix.nr}} 10'
|
||||||
- name: print test failures
|
- name: print test failures
|
||||||
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
|
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
default:
|
default:
|
||||||
timeout: 2h
|
timeout: 2h
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- analyze
|
||||||
|
|
||||||
workflow:
|
workflow:
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
@ -9,6 +14,8 @@ workflow:
|
||||||
|
|
||||||
test:linux:
|
test:linux:
|
||||||
image: $image
|
image: $image
|
||||||
|
stage: test
|
||||||
|
needs: [ ]
|
||||||
tags:
|
tags:
|
||||||
- saas-linux-medium-amd64
|
- saas-linux-medium-amd64
|
||||||
variables:
|
variables:
|
||||||
|
@ -67,6 +74,8 @@ test:linux:
|
||||||
|
|
||||||
test:osx:
|
test:osx:
|
||||||
image: $image
|
image: $image
|
||||||
|
stage: test
|
||||||
|
needs: [ ]
|
||||||
tags:
|
tags:
|
||||||
- saas-macos-medium-m1
|
- saas-macos-medium-m1
|
||||||
variables:
|
variables:
|
||||||
|
@ -100,8 +109,42 @@ test:osx:
|
||||||
- t/failed-test-artifacts
|
- t/failed-test-artifacts
|
||||||
when: on_failure
|
when: on_failure
|
||||||
|
|
||||||
|
build:mingw64:
|
||||||
|
stage: build
|
||||||
|
tags:
|
||||||
|
- saas-windows-medium-amd64
|
||||||
|
variables:
|
||||||
|
NO_PERL: 1
|
||||||
|
before_script:
|
||||||
|
- ./ci/install-sdk.ps1 -directory "git-sdk"
|
||||||
|
script:
|
||||||
|
- git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts'
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- artifacts
|
||||||
|
- git-sdk
|
||||||
|
|
||||||
|
test:mingw64:
|
||||||
|
stage: test
|
||||||
|
tags:
|
||||||
|
- saas-windows-medium-amd64
|
||||||
|
needs:
|
||||||
|
- job: "build:mingw64"
|
||||||
|
artifacts: true
|
||||||
|
before_script:
|
||||||
|
- git-sdk/usr/bin/bash.exe -l -c 'tar xf artifacts/artifacts.tar.gz'
|
||||||
|
- New-Item -Path .git/info -ItemType Directory
|
||||||
|
- New-Item .git/info/exclude -ItemType File -Value "/git-sdk"
|
||||||
|
script:
|
||||||
|
- git-sdk/usr/bin/bash.exe -l -c "ci/run-test-slice.sh $CI_NODE_INDEX $CI_NODE_TOTAL"
|
||||||
|
after_script:
|
||||||
|
- git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh'
|
||||||
|
parallel: 10
|
||||||
|
|
||||||
test:fuzz-smoke-tests:
|
test:fuzz-smoke-tests:
|
||||||
image: ubuntu:latest
|
image: ubuntu:latest
|
||||||
|
stage: test
|
||||||
|
needs: [ ]
|
||||||
variables:
|
variables:
|
||||||
CC: clang
|
CC: clang
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -111,6 +154,8 @@ test:fuzz-smoke-tests:
|
||||||
|
|
||||||
static-analysis:
|
static-analysis:
|
||||||
image: ubuntu:22.04
|
image: ubuntu:22.04
|
||||||
|
stage: analyze
|
||||||
|
needs: [ ]
|
||||||
variables:
|
variables:
|
||||||
jobname: StaticAnalysis
|
jobname: StaticAnalysis
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -121,6 +166,8 @@ static-analysis:
|
||||||
|
|
||||||
check-whitespace:
|
check-whitespace:
|
||||||
image: ubuntu:latest
|
image: ubuntu:latest
|
||||||
|
stage: analyze
|
||||||
|
needs: [ ]
|
||||||
before_script:
|
before_script:
|
||||||
- ./ci/install-dependencies.sh
|
- ./ci/install-dependencies.sh
|
||||||
# Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
|
# Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
|
||||||
|
@ -135,6 +182,8 @@ check-whitespace:
|
||||||
|
|
||||||
check-style:
|
check-style:
|
||||||
image: ubuntu:latest
|
image: ubuntu:latest
|
||||||
|
stage: analyze
|
||||||
|
needs: [ ]
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
variables:
|
variables:
|
||||||
CC: clang
|
CC: clang
|
||||||
|
@ -153,6 +202,8 @@ check-style:
|
||||||
|
|
||||||
documentation:
|
documentation:
|
||||||
image: ubuntu:latest
|
image: ubuntu:latest
|
||||||
|
stage: analyze
|
||||||
|
needs: [ ]
|
||||||
variables:
|
variables:
|
||||||
jobname: Documentation
|
jobname: Documentation
|
||||||
before_script:
|
before_script:
|
||||||
|
|
12
ci/install-sdk.ps1
Executable file
12
ci/install-sdk.ps1
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
param(
|
||||||
|
[string]$directory='git-sdk',
|
||||||
|
[string]$url='https://github.com/git-for-windows/git-sdk-64/releases/download/ci-artifacts/git-sdk-x86_64-minimal.zip'
|
||||||
|
)
|
||||||
|
|
||||||
|
Invoke-WebRequest "$url" -OutFile git-sdk.zip
|
||||||
|
Expand-Archive -LiteralPath git-sdk.zip -DestinationPath "$directory"
|
||||||
|
Remove-Item -Path git-sdk.zip
|
||||||
|
|
||||||
|
New-Item -Path .git/info -ItemType Directory -Force
|
||||||
|
New-Item -Path .git/info/exclude -ItemType File -Force
|
||||||
|
Add-Content -Path .git/info/exclude -Value "/$directory"
|
18
ci/lib.sh
18
ci/lib.sh
|
@ -250,8 +250,13 @@ then
|
||||||
CI_TYPE=gitlab-ci
|
CI_TYPE=gitlab-ci
|
||||||
CI_BRANCH="$CI_COMMIT_REF_NAME"
|
CI_BRANCH="$CI_COMMIT_REF_NAME"
|
||||||
CI_COMMIT="$CI_COMMIT_SHA"
|
CI_COMMIT="$CI_COMMIT_SHA"
|
||||||
case "$CI_JOB_IMAGE" in
|
|
||||||
macos-*)
|
case "$OS,$CI_JOB_IMAGE" in
|
||||||
|
Windows_NT,*)
|
||||||
|
CI_OS_NAME=windows
|
||||||
|
JOBS=$NUMBER_OF_PROCESSORS
|
||||||
|
;;
|
||||||
|
*,macos-*)
|
||||||
# GitLab CI has Python installed via multiple package managers,
|
# GitLab CI has Python installed via multiple package managers,
|
||||||
# most notably via asdf and Homebrew. Ensure that our builds
|
# most notably via asdf and Homebrew. Ensure that our builds
|
||||||
# pick up the Homebrew one by prepending it to our PATH as the
|
# pick up the Homebrew one by prepending it to our PATH as the
|
||||||
|
@ -259,9 +264,12 @@ then
|
||||||
export PATH="$(brew --prefix)/bin:$PATH"
|
export PATH="$(brew --prefix)/bin:$PATH"
|
||||||
|
|
||||||
CI_OS_NAME=osx
|
CI_OS_NAME=osx
|
||||||
|
JOBS=$(nproc)
|
||||||
|
;;
|
||||||
|
*,alpine:*|*,fedora:*|*,ubuntu:*)
|
||||||
|
CI_OS_NAME=linux
|
||||||
|
JOBS=$(nproc)
|
||||||
;;
|
;;
|
||||||
alpine:*|fedora:*|ubuntu:*)
|
|
||||||
CI_OS_NAME=linux;;
|
|
||||||
*)
|
*)
|
||||||
echo "Could not identify OS image" >&2
|
echo "Could not identify OS image" >&2
|
||||||
env >&2
|
env >&2
|
||||||
|
@ -272,6 +280,7 @@ then
|
||||||
CI_JOB_ID="$CI_JOB_ID"
|
CI_JOB_ID="$CI_JOB_ID"
|
||||||
CC="${CC_PACKAGE:-${CC:-gcc}}"
|
CC="${CC_PACKAGE:-${CC:-gcc}}"
|
||||||
DONT_SKIP_TAGS=t
|
DONT_SKIP_TAGS=t
|
||||||
|
|
||||||
handle_failed_tests () {
|
handle_failed_tests () {
|
||||||
create_failed_test_artifacts
|
create_failed_test_artifacts
|
||||||
return 1
|
return 1
|
||||||
|
@ -280,7 +289,6 @@ then
|
||||||
cache_dir="$HOME/none"
|
cache_dir="$HOME/none"
|
||||||
|
|
||||||
distro=$(echo "$CI_JOB_IMAGE" | tr : -)
|
distro=$(echo "$CI_JOB_IMAGE" | tr : -)
|
||||||
JOBS=$(nproc)
|
|
||||||
else
|
else
|
||||||
echo "Could not identify CI type" >&2
|
echo "Could not identify CI type" >&2
|
||||||
env >&2
|
env >&2
|
||||||
|
|
|
@ -747,7 +747,7 @@ test_expect_success MINGW 'handle clean & core.longpaths = false nicely' '
|
||||||
test_must_fail git clean -xdf 2>.git/err &&
|
test_must_fail git clean -xdf 2>.git/err &&
|
||||||
# grepping for a strerror string is unportable but it is OK here with
|
# grepping for a strerror string is unportable but it is OK here with
|
||||||
# MINGW prereq
|
# MINGW prereq
|
||||||
test_grep "too long" .git/err
|
test_grep -e "too long" -e "No such file or directory" .git/err
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'clean untracked paths by pathspec' '
|
test_expect_success 'clean untracked paths by pathspec' '
|
||||||
|
|
Loading…
Reference in a new issue