From 63bedc76655dbedd40500366b8e54bac47441693 Mon Sep 17 00:00:00 2001
From: Yaroslav Lobankov <y.lobankov@tarantool.org>
Date: Thu, 5 May 2022 15:55:16 +0400
Subject: [PATCH] ci: follow-up improvements for gc64 builds

This change contains the following improvements:

1. Prettify view in the job list.

   Before:
     - centos_7 / centos_7 (GC64=OFF)
     - centos_7 / centos_7 (GC64=ON)

   After:
     - centos_7 / centos_7
     - centos_7 / centos_7 (gc64)

2. Change possible values for the ${GC64} env variable to
   `true/false` instead of `ON/OFF` which is more traditional.

3. Use `-DLUAJIT_ENABLE_GC64=ON` flag in the `debian/rules` and
   `rpm/tarantool.spec` files directly instead of providing it
   in the workflow files.

Follows-up tarantool/tarantool-qa#159
Follows-up tarantool/tarantool-qa#161

NO_DOC=ci
NO_TEST=ci
NO_CHANGELOG=ci
---
 .github/workflows/centos_7.yml      |  4 ++--
 .github/workflows/centos_8.yml      |  4 ++--
 .github/workflows/debian_10.yml     |  4 ++--
 .github/workflows/debian_11.yml     |  4 ++--
 .github/workflows/debian_9.yml      |  4 ++--
 .github/workflows/fedora_30.yml     |  4 ++--
 .github/workflows/fedora_31.yml     |  4 ++--
 .github/workflows/fedora_32.yml     |  4 ++--
 .github/workflows/fedora_33.yml     |  4 ++--
 .github/workflows/fedora_34.yml     |  4 ++--
 .github/workflows/fedora_35.yml     |  4 ++--
 .github/workflows/opensuse_15_1.yml |  4 ++--
 .github/workflows/opensuse_15_2.yml |  4 ++--
 .github/workflows/ubuntu_16_04.yml  |  4 ++--
 .github/workflows/ubuntu_18_04.yml  |  4 ++--
 .github/workflows/ubuntu_20_04.yml  |  4 ++--
 .github/workflows/ubuntu_21_04.yml  |  4 ++--
 .github/workflows/ubuntu_21_10.yml  |  4 ++--
 .gitlab.mk                          |  2 +-
 debian/rules                        |  7 +++----
 rpm/tarantool.spec                  | 11 +++++------
 21 files changed, 45 insertions(+), 47 deletions(-)

diff --git a/.github/workflows/centos_7.yml b/.github/workflows/centos_7.yml
index df67349ca5..4321e1c351 100644
--- a/.github/workflows/centos_7.yml
+++ b/.github/workflows/centos_7.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'el'
           DIST: '7'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/centos_8.yml b/.github/workflows/centos_8.yml
index 56cc624502..cb20b0d2fb 100644
--- a/.github/workflows/centos_8.yml
+++ b/.github/workflows/centos_8.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'el'
           DIST: '8'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/debian_10.yml b/.github/workflows/debian_10.yml
index 228577eb16..25727612e3 100644
--- a/.github/workflows/debian_10.yml
+++ b/.github/workflows/debian_10.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'debian'
           DIST: 'buster'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/debian_11.yml b/.github/workflows/debian_11.yml
index 8ce0599b11..9a7056e3a7 100644
--- a/.github/workflows/debian_11.yml
+++ b/.github/workflows/debian_11.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'debian'
           DIST: 'bullseye'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/debian_9.yml b/.github/workflows/debian_9.yml
index aefad39473..2d09923570 100644
--- a/.github/workflows/debian_9.yml
+++ b/.github/workflows/debian_9.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'debian'
           DIST: 'stretch'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/fedora_30.yml b/.github/workflows/fedora_30.yml
index 6c52de05f5..4dc8929fbb 100644
--- a/.github/workflows/fedora_30.yml
+++ b/.github/workflows/fedora_30.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '30'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/fedora_31.yml b/.github/workflows/fedora_31.yml
index b4b38cdb73..a432c36408 100644
--- a/.github/workflows/fedora_31.yml
+++ b/.github/workflows/fedora_31.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '31'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/fedora_32.yml b/.github/workflows/fedora_32.yml
index eba3feeabb..b95cae1db4 100644
--- a/.github/workflows/fedora_32.yml
+++ b/.github/workflows/fedora_32.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '32'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/fedora_33.yml b/.github/workflows/fedora_33.yml
index 4c46c7b5f6..0fd84e1524 100644
--- a/.github/workflows/fedora_33.yml
+++ b/.github/workflows/fedora_33.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '33'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/fedora_34.yml b/.github/workflows/fedora_34.yml
index ffc8e7560c..d61971c660 100644
--- a/.github/workflows/fedora_34.yml
+++ b/.github/workflows/fedora_34.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '34'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/fedora_35.yml b/.github/workflows/fedora_35.yml
index 78f0521c0a..e2c43f102f 100644
--- a/.github/workflows/fedora_35.yml
+++ b/.github/workflows/fedora_35.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '35'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/opensuse_15_1.yml b/.github/workflows/opensuse_15_1.yml
index d0e791814c..c0a8d87593 100644
--- a/.github/workflows/opensuse_15_1.yml
+++ b/.github/workflows/opensuse_15_1.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'opensuse-leap'
           DIST: '15.1'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/opensuse_15_2.yml b/.github/workflows/opensuse_15_2.yml
index fe2e45ea70..3d4e3c741d 100644
--- a/.github/workflows/opensuse_15_2.yml
+++ b/.github/workflows/opensuse_15_2.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'opensuse-leap'
           DIST: '15.2'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/ubuntu_16_04.yml b/.github/workflows/ubuntu_16_04.yml
index 5472a6c4bc..8bd6cc2f43 100644
--- a/.github/workflows/ubuntu_16_04.yml
+++ b/.github/workflows/ubuntu_16_04.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'ubuntu'
           DIST: 'xenial'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/ubuntu_18_04.yml b/.github/workflows/ubuntu_18_04.yml
index 606c3a0cca..0e7bcbad44 100644
--- a/.github/workflows/ubuntu_18_04.yml
+++ b/.github/workflows/ubuntu_18_04.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'ubuntu'
           DIST: 'bionic'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/ubuntu_20_04.yml b/.github/workflows/ubuntu_20_04.yml
index f603fe62b2..67d032123c 100644
--- a/.github/workflows/ubuntu_20_04.yml
+++ b/.github/workflows/ubuntu_20_04.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'ubuntu'
           DIST: 'focal'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/ubuntu_21_04.yml b/.github/workflows/ubuntu_21_04.yml
index 9d8d4769e4..c4e58dc7f7 100644
--- a/.github/workflows/ubuntu_21_04.yml
+++ b/.github/workflows/ubuntu_21_04.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'ubuntu'
           DIST: 'hirsute'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.github/workflows/ubuntu_21_10.yml b/.github/workflows/ubuntu_21_10.yml
index b6462278c9..0868cf58c1 100644
--- a/.github/workflows/ubuntu_21_10.yml
+++ b/.github/workflows/ubuntu_21_10.yml
@@ -44,7 +44,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        gc64: [ "GC64=OFF", "GC64=ON" ]
+        build-type: [ '', 'gc64' ]
 
     steps:
       - uses: actions/checkout@v2.3.4
@@ -57,7 +57,7 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'ubuntu'
           DIST: 'impish'
-          GC64: -DLUAJIT_ENABLE_${{ matrix.gc64 }}
+          GC64: ${{ matrix.build-type == 'gc64' }}
         uses: ./.github/actions/pack_and_deploy
       - name: call action to send Telegram message on failure
         env:
diff --git a/.gitlab.mk b/.gitlab.mk
index 5f7b224914..e1c206c4ea 100644
--- a/.gitlab.mk
+++ b/.gitlab.mk
@@ -125,7 +125,7 @@ deploy:
 		exit 1; \
 	fi; \
 	# Use different repos for vanilla and GC64 version.
-	if [ "$$(echo ${GC64} | sed 's/.*=//')" = ON ]; then \
+	if [ "${GC64}" = "true" ]; then \
 		RWS_ENDPOINT=${RWS_BASE_URL}/${REPO_TYPE}/${TARANTOOL_SERIES}-gc64/${OS}/${DIST}; \
 	else \
 		RWS_ENDPOINT=${RWS_BASE_URL}/${REPO_TYPE}/${TARANTOOL_SERIES}/${OS}/${DIST}; \
diff --git a/debian/rules b/debian/rules
index 7e9f73d11b..e0b1b18447 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,10 +19,9 @@ DEB_CMAKE_EXTRA_FLAGS := \
 	-DWITH_SYSVINIT=ON \
 	-DWITH_SYSTEMD=$(WITH_SYSTEMD)
 
-# Append CMAKE flag with -DLUAJIT_ENABLE_GC64 value. It is required
-# for CI to build Tarantool with GC64 enabled or disabled dynamically.
-ifneq ($(GC64),)
-	DEB_CMAKE_EXTRA_FLAGS += $(GC64)
+# Append -DLUAJIT_ENABLE_GC64=ON flag if ${GC64} env variable is 'true'.
+ifeq ($(GC64), true)
+	DEB_CMAKE_EXTRA_FLAGS += -DLUAJIT_ENABLE_GC64=ON
 endif
 
 # Install tarantool.service within tarantool-common package, but does not
diff --git a/rpm/tarantool.spec b/rpm/tarantool.spec
index e635b6efc2..84cebb12fb 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -11,10 +11,9 @@
 # need to use cmake3 package to build Tarantool on old systems.
 %define use_cmake3 0%{?rhel} == 7
 
-# Get GC64 variable which can keep compiler flag -DLUAJIT_ENABLE_GC64
-# with a value of ON or OFF to enable or disable luajit gc64.
-# It needs to build Tarantool in CI dynamically.
-%define _gc64 %{getenv:GC64}
+# Get ${GC64} env variable which can keep the value of 'true' or 'false' to
+# enable or disable luajit gc64.
+%define _gc64 "%{getenv:GC64}"
 
 %if %use_cmake3
 # XXX: Unfortunately there is no way to make rpmbuild install and
@@ -196,8 +195,8 @@ C and Lua/C modules.
 %if 0%{?fedora} >= 33
          -DENABLE_LTO=ON \
 %endif
-%if "%{_gc64}"
-         %{_gc64} \
+%if %{_gc64} == "true"
+         -DLUAJIT_ENABLE_GC64:BOOL=ON \
 %endif
          -DENABLE_WERROR:BOOL=ON \
          -DENABLE_DIST:BOOL=ON
-- 
GitLab