From 715abaafea84b9dce7cd05f592f4a51a1665ca4d Mon Sep 17 00:00:00 2001
From: Yaroslav Lobankov <y.lobankov@tarantool.org>
Date: Mon, 10 Jun 2024 13:57:16 +0400
Subject: [PATCH] ci: fix RPM package builds on aarch64 runners

We're using LXD containers as aarch64 runners. For some reason, OOM
killer just kills the compilation process while package building when
`make -j $(nproc)`. The issue happens only with builds where LTO is
enabled. It's found, that `-j6` works fine. The bigger value causes
problems.

NO_DOC=ci
NO_TEST=ci
NO_CHANGELOG=ci
---
 .github/actions/environment/action.yml     | 2 +-
 .github/workflows/almalinux_9_aarch64.yml  | 5 +++++
 .github/workflows/fedora_34_aarch64.yml    | 5 +++++
 .github/workflows/fedora_35_aarch64.yml    | 5 +++++
 .github/workflows/fedora_36_aarch64.yml    | 5 +++++
 .github/workflows/fedora_37_aarch64.yml    | 5 +++++
 .github/workflows/fedora_38_aarch64.yml    | 5 +++++
 .github/workflows/fedora_39_aarch64.yml    | 5 +++++
 .github/workflows/ubuntu_22_04_aarch64.yml | 5 +++++
 9 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/.github/actions/environment/action.yml b/.github/actions/environment/action.yml
index 969a340df1..afa5002f90 100644
--- a/.github/actions/environment/action.yml
+++ b/.github/actions/environment/action.yml
@@ -10,7 +10,7 @@ runs:
         echo REPLICATION_SYNC_TIMEOUT=300 | tee -a $GITHUB_ENV
         echo TEST_TIMEOUT=310 | tee -a $GITHUB_ENV
         echo NO_OUTPUT_TIMEOUT=320 | tee -a $GITHUB_ENV
-        echo PRESERVE_ENVVARS=VARDIR,TEST_RUN_RETRIES,SERVER_START_TIMEOUT,REPLICATION_SYNC_TIMEOUT,TEST_TIMEOUT,NO_OUTPUT_TIMEOUT,GC64 | tee -a $GITHUB_ENV
+        echo PRESERVE_ENVVARS=VARDIR,TEST_RUN_RETRIES,SERVER_START_TIMEOUT,REPLICATION_SYNC_TIMEOUT,TEST_TIMEOUT,NO_OUTPUT_TIMEOUT,GC64,SMPFLAGS | tee -a $GITHUB_ENV
         # Configure AWS Region to avoid of issue:
         #   https://github.com/tarantool/tarantool-qa/issues/111
         echo AWS_DEFAULT_REGION=MS | tee -a $GITHUB_ENV
diff --git a/.github/workflows/almalinux_9_aarch64.yml b/.github/workflows/almalinux_9_aarch64.yml
index 38570876e7..532096d0f7 100644
--- a/.github/workflows/almalinux_9_aarch64.yml
+++ b/.github/workflows/almalinux_9_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'almalinux'
           DIST: '9'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
diff --git a/.github/workflows/fedora_34_aarch64.yml b/.github/workflows/fedora_34_aarch64.yml
index 0de0e7c00a..a778033992 100644
--- a/.github/workflows/fedora_34_aarch64.yml
+++ b/.github/workflows/fedora_34_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '34'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
diff --git a/.github/workflows/fedora_35_aarch64.yml b/.github/workflows/fedora_35_aarch64.yml
index 4951110c50..c0281cfd3b 100644
--- a/.github/workflows/fedora_35_aarch64.yml
+++ b/.github/workflows/fedora_35_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '35'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
diff --git a/.github/workflows/fedora_36_aarch64.yml b/.github/workflows/fedora_36_aarch64.yml
index 52fed4f312..83a07c7c0c 100644
--- a/.github/workflows/fedora_36_aarch64.yml
+++ b/.github/workflows/fedora_36_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '36'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
diff --git a/.github/workflows/fedora_37_aarch64.yml b/.github/workflows/fedora_37_aarch64.yml
index 7d39cd5ffa..0e10a81487 100644
--- a/.github/workflows/fedora_37_aarch64.yml
+++ b/.github/workflows/fedora_37_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '37'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
diff --git a/.github/workflows/fedora_38_aarch64.yml b/.github/workflows/fedora_38_aarch64.yml
index a44eabc751..22afc05f2f 100644
--- a/.github/workflows/fedora_38_aarch64.yml
+++ b/.github/workflows/fedora_38_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '38'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
diff --git a/.github/workflows/fedora_39_aarch64.yml b/.github/workflows/fedora_39_aarch64.yml
index fa267c4664..d461213177 100644
--- a/.github/workflows/fedora_39_aarch64.yml
+++ b/.github/workflows/fedora_39_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'fedora'
           DIST: '39'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
diff --git a/.github/workflows/ubuntu_22_04_aarch64.yml b/.github/workflows/ubuntu_22_04_aarch64.yml
index c71218a8fc..d33529b07e 100644
--- a/.github/workflows/ubuntu_22_04_aarch64.yml
+++ b/.github/workflows/ubuntu_22_04_aarch64.yml
@@ -55,6 +55,11 @@ jobs:
           RWS_AUTH: ${{ secrets.RWS_AUTH }}
           OS: 'ubuntu'
           DIST: 'jammy'
+          # We're using LXD containers as aarch64 runners. For some reason, OOM
+          # killer just kills the compilation process when `make -j $(nproc)`.
+          # The issue happens only with builds where LTO is enabled. It's found,
+          # that `-j6` works fine. The bigger value causes problems.
+          SMPFLAGS: '-j6'
         uses: ./.github/actions/pack-and-deploy
       - name: Send VK Teams message on failure
         if: failure()
-- 
GitLab