Add a CI for unsigned char system
cover Add a CI for unsigned char system
Recently, we have a brokeness on system with unsigned char because most of people are working with x86_64 which has signed char.
This series tries to add a CI system for a widely used system with signed char, which is arm64 via circle-ci.
In order to register for git to participate in Circle CI, you need to:
- Create an account and login into Circle CI, (I tried login with GitHub OAuth);
- Register a project with Circle CI, and choose which config.yml we would like to be used for Circle CI
Circle CI seems to allow 40000 (Forty thousand credits per month), in my testing, with resource_class: 'arm.medium', (which costs 10 credits per minute), it take 12m15s to finish, so that will be about 3000 run per month. I believe arm.large, which is also available to free accounts and cost 20 credits per minute, doesn't cost effective but I haven't checked out.
Sample run:
- Without the fix for unsigned char:
https://app.circleci.com/pipelines/gh/sgn/git/12/workflows/9b39391d-0d03-4669-86e6-2796fd671c43/jobs/10
- Normal run:
https://app.circleci.com/pipelines/gh/sgn/git/14/workflows/b8745f8e-8a57-4215-847e-2af66c1dd3c7/jobs/12
I'm not really sure if we want the 'store_test_results', which will upload the test report in the 'TESTS' tab:
https://app.circleci.com/pipelines/gh/sgn/git/14/workflows/b8745f8e-8a57-4215-847e-2af66c1dd3c7/jobs/12/tests
and provides a test insights like this:
https://app.circleci.com/insights/gh/sgn/git/workflows/workflow/tests?branch=circle-ci
Đoàn Trần Công Danh (4):
ci/lib.sh: remove an useless break ci/install-dependencies: libify p4 and git-lfs installation ci/install-dependencies: install git-lfs for arm64 build
ci: add arm64 CI environment via CircleCI
.circleci/config.yml | 17 +++++++++++++++ ci/install-dependencies.sh | 42 ++++++++++++++++++++++++++++++-------- ci/lib.sh | 30 ++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 .circleci/config.yml
Signature · 1 line
2.40.0.rc1.2.gd15644fe02
PATCH 1/4 ci/lib.sh: remove an useless break
This statement was silently skipped for a long time.
Quoted 1 line
ci/lib.sh: line 232: break: only meaningful in afor',while', or `until' loop
--- ci/lib.sh | 5 ----- 1 file changed, 5 deletions(-)
ci/lib.sh +0 -5
@@ -227,11 +227,6 @@ export SKIP_DASHED_BUILT_INS=YesPlease case "$runs_on_pool" in ubuntu-*) - if test "$jobname" = "linux-gcc-default" - then - break - fi - PYTHON_PACKAGE=python2 if test "$jobname" = linux-gcc then
Signature · 1 line
2.40.0.rc1.2.gd15644fe02
PATCH 2/4 ci/install-dependencies: libify p4 and git-lfs installation
In reply to Đoàn Trần Công DanhIn a later change, we will install git-lfs for CircleCI test environment. Let move those installations out in order to reuse them.
--- ci/install-dependencies.sh | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-)
ci/install-dependencies.sh +29 -9
@@ -6,16 +6,12 @@ . ${0%/*}/lib.sh P4WHENCE=https://cdist2.perforce.com/perforce/r21.2 -LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION +LFSWHENCE=https://github.com/github/git-lfs/releases/download UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl" -case "$runs_on_pool" in -ubuntu-*) - sudo apt-get -q update - sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \ - $UBUNTU_COMMON_PKGS $CC_PACKAGE $PYTHON_PACKAGE +_install_linux_p4() { mkdir --parents "$P4_PATH" pushd "$P4_PATH" wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
@@ -23,12 +19,36 @@ ubuntu-*) chmod u+x p4d chmod u+x p4 popd +} + +_install_linux_git_lfs() { + local whence fname + whence="$1" + fname="$2" mkdir --parents "$GIT_LFS_PATH" pushd "$GIT_LFS_PATH" - wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" - tar --extract --gunzip --file "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" - cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs . + wget --quiet "$whence/$fname" + tar --extract --gunzip --strip-components=1 --file "$fname" popd +} + +case "$runs_on_pool" in +ubuntu-*) + sudo apt-get -q update + sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \ + $UBUNTU_COMMON_PKGS $CC_PACKAGE $PYTHON_PACKAGE + + case "$(uname -m)" in + x86_64) + _install_linux_p4 + _install_linux_git_lfs "$LFSWHENCE/v${LINUX_GIT_LFS_VERSION}" \ + "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" + ;; + *) + echo "Not supported architecture" >&2 + exit 1 + ;; + esac ;; macos-*) export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
Signature · 1 line
2.40.0.rc1.2.gd15644fe02
PATCH 3/4 ci/install-dependencies: install git-lfs for arm64 build
In reply to Đoàn Trần Công Danh--- ci/install-dependencies.sh | 4 ++++ ci/lib.sh | 6 ++++++ 2 files changed, 10 insertions(+)
ci/install-dependencies.sh +4 -0
@@ -44,6 +44,10 @@ ubuntu-*) _install_linux_git_lfs "$LFSWHENCE/v${LINUX_GIT_LFS_VERSION}" \ "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" ;; + aarch64) + _install_linux_git_lfs "$LFSWHENCE/v${LINUX_GIT_LFS_VERSION}" \ + "git-lfs-linux-arm64-v$LINUX_GIT_LFS_VERSION.tar.gz" + ;; *) echo "Not supported architecture" >&2 exit 1
ci/lib.sh +6 -0
@@ -242,6 +242,12 @@ ubuntu-*) # image. # Keep that in mind when you encounter a broken OS X build! export LINUX_GIT_LFS_VERSION="1.5.2" + # The Linux arm64 build installs yet another recent version, since + # above version doesn't ship prebuilt binaries for arm64. + if test "$(uname -m)" = aarch64 + then + LINUX_GIT_LFS_VERSION="3.3.0" + fi P4_PATH="$HOME/custom/p4" GIT_LFS_PATH="$HOME/custom/git-lfs"
Signature · 1 line
2.40.0.rc1.2.gd15644fe02
PATCH 4/4 ci: add arm64 CI environment via CircleCI
In reply to Đoàn Trần Công Danh--- .circleci/config.yml | 17 +++++++++++++++++ ci/lib.sh | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .circleci/config.yml
.circleci/config.yml new file +17 -0
@@ -0,0 +1,17 @@ +# .circleci/config.yml +jobs: + build: + machine: + image: ubuntu-2004:2022.04.1 + resource_class: arm.medium + environment: + jobname: linux-gcc + runs_on_pool: ubuntu-arm64 + steps: + - checkout + - run: ci/install-dependencies.sh + - run: + name: Build and Tests + command: ci/run-build-and-tests.sh + - store_test_results: + path: t/out
ci/lib.sh +19 -0
@@ -201,6 +201,25 @@ then MAKEFLAGS="$MAKEFLAGS --jobs=10" test windows != "$CI_OS_NAME" || GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" +elif test "$CIRCLECI" = true +then + CI_TYPE=circleci + CI_BRANCH="$CIRCLE_BRANCH" + CI_COMMIT="$CIRCLE_SHA1" + CI_JOB_ID="$CIRCLE_WORKFLOW_JOB_ID" + CI_JOB_NUMBER="$CIRCLE_BUILD_NUM" + CI_OS_NAME="$(echo "$AGENT_OS" | tr A-Z a-z)" + test darwin != "$CI_OS_NAME" || CI_OS_NAME=osx + CI_REPO_SLUG="$(expr "$CIRCLE_REPOSITORY_URL" : '.*:\([^/]*/[^/]*\)\.git$')" + CC="${CC:-gcc}" + + # use a subdirectory of the cache dir (because the file share is shared + # among *all* phases) + cache_dir="$HOME/none" + + export GIT_PROVE_OPTS="--timer --jobs 10" + export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" + MAKEFLAGS="$MAKEFLAGS --jobs=10" else echo "Could not identify CI type" >&2 env >&2
Signature · 1 line
2.40.0.rc1.2.gd15644fe02
Re: [PATCH 4/4] ci: add arm64 CI environment via CircleCI
Quoted 36 lines · Đoàn Trần Công Danh
Signed-off-by Đoàn Trần Công Danh <[email protected]>--- .circleci/config.yml | 17 +++++++++++++++++ ci/lib.sh | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .circleci/config.yml.circleci/config.yml new file +17
-0@@ -0,0 +1,17 @@ +# .circleci/config.yml +jobs: + build: + machine: + image: ubuntu-2004:2022.04.1 + resource_class: arm.medium + environment: + jobname: linux-gcc + runs_on_pool: ubuntu-arm64 + steps: + - checkout + - run: ci/install-dependencies.sh + - run: + name: Build and Tests + command: ci/run-build-and-tests.sh + - store_test_results: + path: t/outci/lib.sh +0
-0@@ -201,6 +201,25 @@ then MAKEFLAGS="$MAKEFLAGS --jobs=10"
ci/lib.sh then · line 211
Quoted 10 lines
ci/lib.sh +8
-0test windows != "$CI_OS_NAME" || GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" +elif test "$CIRCLECI" = true +then + CI_TYPE=circleci + CI_BRANCH="$CIRCLE_BRANCH" + CI_COMMIT="$CIRCLE_SHA1" + CI_JOB_ID="$CIRCLE_WORKFLOW_JOB_ID" + CI_JOB_NUMBER="$CIRCLE_BUILD_NUM" + CI_OS_NAME="$(echo "$AGENT_OS" | tr A-Z a-z)"
Oops, this is wrong, it should be:
CI_OS_NAME="$(uname -s)-$(uname -m)"
Quoted 17 lines
ci/lib.sh +11
-0+ test darwin != "$CI_OS_NAME" || CI_OS_NAME=osx + CI_REPO_SLUG="$(expr "$CIRCLE_REPOSITORY_URL" : '.*:\([^/]*/[^/]*\)\.git$')" + CC="${CC:-gcc}" + + # use a subdirectory of the cache dir (because the file share is shared + # among *all* phases) + cache_dir="$HOME/none" + + export GIT_PROVE_OPTS="--timer --jobs 10" + export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" + MAKEFLAGS="$MAKEFLAGS --jobs=10" else echo "Could not identify CI type" >&2 env >&2Signature · 1 line
2.40.0.rc1.2.gd15644fe02
Signature · 1 line
Danh
Quoted 5 lines · Đoàn Trần Công Danh
Recently, we have a brokeness on system with unsigned char because most of people are working with
x86_64which has signed char.This series tries to add a CI system for a widely used system with signed char, which is arm64 via circle-ci.
I like the overall goal, but I'm not wild about having another CI provider. That requires people logging in there, and then dealing with possible credit overages, etc.
I wonder what the timeline is for GitHub Actions getting arm64 support. It looks like there are images for linux/arm64, but no runners yet, according to:
https://github.com/actions/runner-images/issues/5631
You can point it at your own runners, and some people in that thread mentioned a third-party service which provides arm machines. That doesn't get out of the "oops, credits" handling, but it would at least keep the CI results all together.
I dunno. Another option I saw suggested is using qemu within a regular GitHub runner. I have no idea if that would be painfully slow or what, but it looks like people have even written actions to handle it:
https://github.com/docker/setup-qemu-action
-Peff
Quoted 2 lines · Jeff King
I like the overall goal, but I'm not wild about having another CI provider.
So, why not do an x86 build with -funsigned-char? Seems to work with both gcc and clang.
Chris
Quoted 6 lines · Chris Torek
Quoted 2 lines · Jeff King
I like the overall goal, but I'm not wild about having another CI provider.
So, why not do an x86 build with
-funsigned-char? Seems to work with both gcc and clang.
Yeah, that would be even simpler. Though IMHO "unsigned char" is only one interesting difference to be checking. Another would be having a platform where unaligned access isn't tolerated. It would be nice to have a big-endian platform, too, but I'm not sure if arm is a good fit there (my impression is that it can be run in either mode?).
On the other hand, I think Ævar does periodically run on the gcc build machines, which includes examples of each (including aarch64). And this particular bug was found pretty quickly (within a week of it hitting next, and only a day after hitting master). So while it might be nice to have more immediate CI feedback, it does seem like the old "if the platform matters, somebody will try it and report the problem" strategy still works, too.
-Peff