Signed-off-by: Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx> --- .travis.yml | 8 ++++++++ azure-pipelines.yml | 35 +++++++++++++++++++++++++++++++++++ ci/run-alpine-build.sh | 31 +++++++++++++++++++++++++++++++ ci/run-docker.sh | 4 ++++ 4 files changed, 78 insertions(+) create mode 100755 ci/run-alpine-build.sh diff --git a/.travis.yml b/.travis.yml index 069aeeff3c..0cfc3c3428 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,14 @@ matrix: - docker before_install: script: ci/run-docker.sh + - env: jobname=linux-musl + os: linux + compiler: + addons: + services: + - docker + before_install: + script: ci/run-docker.sh - env: jobname=StaticAnalysis os: linux compiler: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f6dcc35ad4..615289167b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -503,6 +503,41 @@ jobs: PathtoPublish: t/failed-test-artifacts ArtifactName: failed-test-artifacts +- job: linux_musl + displayName: linux-musl + condition: succeeded() + pool: + vmImage: ubuntu-latest + steps: + - bash: | + test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1 + + res=0 + sudo AGENT_OS="$AGENT_OS" BUILD_BUILDNUMBER="$BUILD_BUILDNUMBER" BUILD_REPOSITORY_URI="$BUILD_REPOSITORY_URI" BUILD_SOURCEBRANCH="$BUILD_SOURCEBRANCH" BUILD_SOURCEVERSION="$BUILD_SOURCEVERSION" SYSTEM_PHASENAME="$SYSTEM_PHASENAME" SYSTEM_TASKDEFINITIONSURI="$SYSTEM_TASKDEFINITIONSURI" SYSTEM_TEAMPROJECT="$SYSTEM_TEAMPROJECT" CC=$CC MAKEFLAGS="$MAKEFLAGS" jobname=linux-musl bash -lxc ci/run-docker.sh || res=1 + + sudo chmod a+r t/out/TEST-*.xml + test ! -d t/failed-test-artifacts || sudo chmod a+r t/failed-test-artifacts + + test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || res=1 + exit $res + displayName: 'jobname=linux-musl ci/run-docker.sh' + env: + GITFILESHAREPWD: $(gitfileshare.pwd) + - task: PublishTestResults@2 + displayName: 'Publish Test Results **/TEST-*.xml' + inputs: + mergeTestResults: true + testRunTitle: 'musl' + platform: Linux + publishRunAttachments: false + condition: succeededOrFailed() + - task: PublishBuildArtifacts@1 + displayName: 'Publish trash directories of failed tests' + condition: failed() + inputs: + PathtoPublish: t/failed-test-artifacts + ArtifactName: failed-test-artifacts + - job: static_analysis displayName: StaticAnalysis condition: succeeded() diff --git a/ci/run-alpine-build.sh b/ci/run-alpine-build.sh new file mode 100755 index 0000000000..c83df536e4 --- /dev/null +++ b/ci/run-alpine-build.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Build and test Git in Alpine Linux +# +# Usage: +# run-alpine-build.sh <host-user-id> +# + +set -ex + +useradd () { + adduser -D "$@" +} + +. "${0%/*}/lib-docker.sh" + +# Update packages to the latest available versions +apk add --update autoconf build-base curl-dev openssl-dev expat-dev \ + gettext pcre2-dev python3 musl-libintl >/dev/null + +# Build and test +su -m -l $CI_USER -c ' + set -ex + cd /usr/src/git + test -n "$cache_dir" && ln -s "$cache_dir/.prove" t/.prove + autoconf + echo "PYTHON_PATH=/usr/bin/python3" >config.mak + ./configure --with-libpcre + make + make test +' diff --git a/ci/run-docker.sh b/ci/run-docker.sh index be698817cb..f203db03cf 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -10,6 +10,10 @@ Linux32) CI_TARGET=linux32 CI_CONTAINER="daald/ubuntu32:xenial" ;; +linux-musl) + CI_TARGET=alpine + CI_CONTAINER=alpine + ;; *) exit 1 ;; esac -- 2.26.0.302.g234993491e