git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/4] Add a CI for unsigned char system
@ 2023-03-03 13:46 Đoàn Trần Công Danh
  2023-03-03 13:46 ` [PATCH 1/4] ci/lib.sh: remove an useless break Đoàn Trần Công Danh
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Đoàn Trần Công Danh @ 2023-03-03 13:46 UTC (permalink / raw)
  To: git; +Cc: Đ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_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

-- 
2.40.0.rc1.2.gd15644fe02


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] ci/lib.sh: remove an useless break
  2023-03-03 13:46 [PATCH 0/4] Add a CI for unsigned char system Đoàn Trần Công Danh
@ 2023-03-03 13:46 ` Đoàn Trần Công Danh
  2023-03-03 13:46 ` [PATCH 2/4] ci/install-dependencies: libify p4 and git-lfs installation Đoàn Trần Công Danh
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Đoàn Trần Công Danh @ 2023-03-03 13:46 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

This statement was silently skipped for a long time.

> ci/lib.sh: line 232: break: only meaningful in a `for', `while', or `until' loop

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 ci/lib.sh | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/ci/lib.sh b/ci/lib.sh
index db7105e8a8..661076e70b 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -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
-- 
2.40.0.rc1.2.gd15644fe02


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] ci/install-dependencies: libify p4 and git-lfs installation
  2023-03-03 13:46 [PATCH 0/4] Add a CI for unsigned char system Đoàn Trần Công Danh
  2023-03-03 13:46 ` [PATCH 1/4] ci/lib.sh: remove an useless break Đoàn Trần Công Danh
@ 2023-03-03 13:46 ` Đoàn Trần Công Danh
  2023-03-03 13:46 ` [PATCH 3/4] ci/install-dependencies: install git-lfs for arm64 build Đoàn Trần Công Danh
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Đoàn Trần Công Danh @ 2023-03-03 13:46 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

In a later change, we will install git-lfs for CircleCI test
environment. Let move those installations out in order to reuse them.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 ci/install-dependencies.sh | 38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 4f407530d3..9a32af8968 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -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
-- 
2.40.0.rc1.2.gd15644fe02


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] ci/install-dependencies: install git-lfs for arm64 build
  2023-03-03 13:46 [PATCH 0/4] Add a CI for unsigned char system Đoàn Trần Công Danh
  2023-03-03 13:46 ` [PATCH 1/4] ci/lib.sh: remove an useless break Đoàn Trần Công Danh
  2023-03-03 13:46 ` [PATCH 2/4] ci/install-dependencies: libify p4 and git-lfs installation Đoàn Trần Công Danh
@ 2023-03-03 13:46 ` Đoàn Trần Công Danh
  2023-03-03 13:46 ` [PATCH 4/4] ci: add arm64 CI environment via CircleCI Đoàn Trần Công Danh
  2023-03-09  9:53 ` [PATCH 0/4] Add a CI for unsigned char system Jeff King
  4 siblings, 0 replies; 9+ messages in thread
From: Đoàn Trần Công Danh @ 2023-03-03 13:46 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 ci/install-dependencies.sh | 4 ++++
 ci/lib.sh                  | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 9a32af8968..6d587ffc54 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -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
diff --git a/ci/lib.sh b/ci/lib.sh
index 661076e70b..3c19267a56 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -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"
-- 
2.40.0.rc1.2.gd15644fe02


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] ci: add arm64 CI environment via CircleCI
  2023-03-03 13:46 [PATCH 0/4] Add a CI for unsigned char system Đoàn Trần Công Danh
                   ` (2 preceding siblings ...)
  2023-03-03 13:46 ` [PATCH 3/4] ci/install-dependencies: install git-lfs for arm64 build Đoàn Trần Công Danh
@ 2023-03-03 13:46 ` Đoàn Trần Công Danh
  2023-03-03 13:54   ` Đoàn Trần Công Danh
  2023-03-09  9:53 ` [PATCH 0/4] Add a CI for unsigned char system Jeff King
  4 siblings, 1 reply; 9+ messages in thread
From: Đoàn Trần Công Danh @ 2023-03-03 13:46 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 .circleci/config.yml | 17 +++++++++++++++++
 ci/lib.sh            | 19 +++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 .circleci/config.yml

diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000000..2f5e0966b7
--- /dev/null
+++ b/.circleci/config.yml
@@ -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
diff --git a/ci/lib.sh b/ci/lib.sh
index 3c19267a56..8b0c727950 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -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
-- 
2.40.0.rc1.2.gd15644fe02


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] ci: add arm64 CI environment via CircleCI
  2023-03-03 13:46 ` [PATCH 4/4] ci: add arm64 CI environment via CircleCI Đoàn Trần Công Danh
@ 2023-03-03 13:54   ` Đoàn Trần Công Danh
  0 siblings, 0 replies; 9+ messages in thread
From: Đoàn Trần Công Danh @ 2023-03-03 13:54 UTC (permalink / raw)
  To: git

On 2023-03-03 20:46:06+0700, Đoàn Trần Công Danh <congdanhqx@gmail.com> wrote:
> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
> ---
>  .circleci/config.yml | 17 +++++++++++++++++
>  ci/lib.sh            | 19 +++++++++++++++++++
>  2 files changed, 36 insertions(+)
>  create mode 100644 .circleci/config.yml
> 
> diff --git a/.circleci/config.yml b/.circleci/config.yml
> new file mode 100644
> index 0000000000..2f5e0966b7
> --- /dev/null
> +++ b/.circleci/config.yml
> @@ -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
> diff --git a/ci/lib.sh b/ci/lib.sh
> index 3c19267a56..8b0c727950 100755
> --- a/ci/lib.sh
> +++ b/ci/lib.sh
> @@ -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)"

Oops, this is wrong, it should be:

	CI_OS_NAME="$(uname -s)-$(uname -m)"

> +	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
> -- 
> 2.40.0.rc1.2.gd15644fe02
> 

-- 
Danh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] Add a CI for unsigned char system
  2023-03-03 13:46 [PATCH 0/4] Add a CI for unsigned char system Đoàn Trần Công Danh
                   ` (3 preceding siblings ...)
  2023-03-03 13:46 ` [PATCH 4/4] ci: add arm64 CI environment via CircleCI Đoàn Trần Công Danh
@ 2023-03-09  9:53 ` Jeff King
  2023-03-09 10:26   ` Chris Torek
  4 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2023-03-09  9:53 UTC (permalink / raw)
  To: Đoàn Trần Công Danh; +Cc: git

On Fri, Mar 03, 2023 at 08:46:02PM +0700, Đoàn Trần Công Danh wrote:

> 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.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] Add a CI for unsigned char system
  2023-03-09  9:53 ` [PATCH 0/4] Add a CI for unsigned char system Jeff King
@ 2023-03-09 10:26   ` Chris Torek
  2023-03-09 10:57     ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Torek @ 2023-03-09 10:26 UTC (permalink / raw)
  To: Jeff King; +Cc: Đoàn Trần Công Danh, git

On Thu, Mar 9, 2023 at 1:54 AM Jeff King <peff@peff.net> wrote:
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] Add a CI for unsigned char system
  2023-03-09 10:26   ` Chris Torek
@ 2023-03-09 10:57     ` Jeff King
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2023-03-09 10:57 UTC (permalink / raw)
  To: Chris Torek; +Cc: Đoàn Trần Công Danh, git

On Thu, Mar 09, 2023 at 02:26:34AM -0800, Chris Torek wrote:

> On Thu, Mar 9, 2023 at 1:54 AM Jeff King <peff@peff.net> wrote:
> > 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-09 11:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 13:46 [PATCH 0/4] Add a CI for unsigned char system Đoàn Trần Công Danh
2023-03-03 13:46 ` [PATCH 1/4] ci/lib.sh: remove an useless break Đoàn Trần Công Danh
2023-03-03 13:46 ` [PATCH 2/4] ci/install-dependencies: libify p4 and git-lfs installation Đoàn Trần Công Danh
2023-03-03 13:46 ` [PATCH 3/4] ci/install-dependencies: install git-lfs for arm64 build Đoàn Trần Công Danh
2023-03-03 13:46 ` [PATCH 4/4] ci: add arm64 CI environment via CircleCI Đoàn Trần Công Danh
2023-03-03 13:54   ` Đoàn Trần Công Danh
2023-03-09  9:53 ` [PATCH 0/4] Add a CI for unsigned char system Jeff King
2023-03-09 10:26   ` Chris Torek
2023-03-09 10:57     ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).