[Tarantool-patches] [PATCH luajit] ci: introduce GitHub Actions

Igor Munkin imun at tarantool.org
Tue Mar 1 16:15:41 MSK 2022


This patch introduces the following testing matrix for our LuaJIT fork:

+--------------------------------+------------------+-------------+
|                                |      Linux       |    macOS    |
|                                +--------+---------+--------+----+
|                                | x86_64 | aarch64 | x86_64 | M1 |
+---------------+----------------+--------+---------+--------+----+
|               | RelWithDebInfo |   +    |    +    |   +    | +  |
+ GC64 disabled +----------------+--------+---------+--------+----+
|               | Debug(*)       |   +    |    +    |   +    | +  |
+---------------+----------------+--------+---------+--------+----+
|               | RelWithDebInfo |   +    |    +    |   +    | +  |
+ GC64 enabled  +----------------+--------+---------+--------+----+
|               | Debug(*)       |   +    |    +    |   +    | +  |
+---------------+----------------+--------+---------+--------+----+

(*) Debug build also uses LuaJIT internal assertions.

For each column there is a separate workflow file, since it requires a
specific runner and setup routine. For each row workflow toggles GC64
mode and build type flags and triggers the run with the chosen
configuration options.

There is one more workflow running only static analysis check. This
division is caused by specific requirements to be installed (i.e.
luarocks and luacheck). For other workflows <LuaJIT-luacheck> rule is
just a noop step (see test/CMakeLists.txt for more info).

All workflows are not triggered for the branches with "-notest" suffix
and also "upstream-" prefix (but they are unlikely to be merged into the
latter ones anyway). Nothing is also triggered for all tags.

There is also one nit to be mentioned: actively running workflows on all
branches except the long-term ones (i.e. tarantool, tarantool-1.10, etc)
are canceled if "force push" occurs.

Signed-off-by: Igor Munkin <imun at tarantool.org>
---
 .github/workflows/lint.yml          | 47 ++++++++++++++++++++
 .github/workflows/linux-aarch64.yml | 57 +++++++++++++++++++++++++
 .github/workflows/linux-x86_64.yml  | 57 +++++++++++++++++++++++++
 .github/workflows/macos-m1.yml      | 66 +++++++++++++++++++++++++++++
 .github/workflows/macos-x86_64.yml  | 66 +++++++++++++++++++++++++++++
 5 files changed, 293 insertions(+)
 create mode 100644 .github/workflows/lint.yml
 create mode 100644 .github/workflows/linux-aarch64.yml
 create mode 100644 .github/workflows/linux-x86_64.yml
 create mode 100644 .github/workflows/macos-m1.yml
 create mode 100644 .github/workflows/macos-x86_64.yml

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..e0cb8eff
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,47 @@
+name: "Static analysis"
+
+on:
+  push:
+    branches-ignore:
+      - '**-notest'
+      - 'upstream-**'
+    tags-ignore:
+      - '**'
+
+concurrency:
+  # Update of a developer branch cancels the previously scheduled
+  # workflow run for this branch. However, the default branch,
+  # and long-term branch (tarantool-1.10, tarantool-2.8, etc.)
+  # workflow runs are never canceled.
+  #
+  # We use a trick here: define the concurrency group as 'workflow
+  # run ID' + # 'workflow run attempt' because it is a unique
+  # combination for any run. So it effectively discards grouping.
+  #
+  # XXX: we cannot use `github.sha` as a unique identifier because
+  # pushing a tag may cancel a run that works on a branch push
+  # event.
+  group: ${{ (
+    github.ref == 'refs/heads/tarantool' ||
+    startsWith(github.ref, 'refs/heads/tarantool-')) &&
+    format('{0}-{1}', github.run_id, github.run_attempt) ||
+    format('{0}-{1}', github.workflow, github.ref) }}
+  cancel-in-progress: true
+
+jobs:
+  test-luacheck:
+    runs-on: ubuntu-20.04-self-hosted
+    steps:
+      - uses: actions/checkout at v2.3.4
+        with:
+          fetch-depth: 0
+          submodules: recursive
+      - name: setup
+        run: |
+          sudo apt -y update
+          sudo apt -y install cmake make lua5.1 luarocks
+          sudo luarocks install luacheck
+      - name: configure
+        run: cmake .
+      - name: test
+        run: make -j LuaJIT-luacheck
diff --git a/.github/workflows/linux-aarch64.yml b/.github/workflows/linux-aarch64.yml
new file mode 100644
index 00000000..a43d22ac
--- /dev/null
+++ b/.github/workflows/linux-aarch64.yml
@@ -0,0 +1,57 @@
+name: "LuaJIT test workflow (Linux/AArch64)"
+
+on:
+  push:
+    branches-ignore:
+      - '**-notest'
+      - 'upstream-**'
+    tags-ignore:
+      - '**'
+
+concurrency:
+  # Update of a developer branch cancels the previously scheduled
+  # workflow run for this branch. However, the default branch,
+  # and long-term branch (tarantool-1.10, tarantool-2.8, etc.)
+  # workflow runs are never canceled.
+  #
+  # We use a trick here: define the concurrency group as 'workflow
+  # run ID' + # 'workflow run attempt' because it is a unique
+  # combination for any run. So it effectively discards grouping.
+  #
+  # XXX: we cannot use `github.sha` as a unique identifier because
+  # pushing a tag may cancel a run that works on a branch push
+  # event.
+  group: ${{ (
+    github.ref == 'refs/heads/tarantool' ||
+    startsWith(github.ref, 'refs/heads/tarantool-')) &&
+    format('{0}-{1}', github.run_id, github.run_attempt) ||
+    format('{0}-{1}', github.workflow, github.ref) }}
+  cancel-in-progress: true
+
+jobs:
+  test-linux-aarch64:
+    runs-on: graviton
+    strategy:
+      matrix:
+        BUILDTYPE:
+          - -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON
+          - -DCMAKE_BUILD_TYPE=RelWithDebInfo
+        GC64:
+          - -DLUAJIT_ENABLE_GC64=ON
+          - -DLUAJIT_ENABLE_GC64=OFF
+
+    steps:
+      - uses: actions/checkout at v2.3.4
+        with:
+          fetch-depth: 0
+          submodules: recursive
+      - name: setup
+        run: |
+          sudo apt -y update
+          sudo apt -y install cmake gcc make perl
+      - name: configure
+        run: cmake . ${{ matrix.BUILDTYPE }} ${{ matrix.GC64 }}
+      - name: build
+        run: make -j
+      - name: test
+        run: make -j test
diff --git a/.github/workflows/linux-x86_64.yml b/.github/workflows/linux-x86_64.yml
new file mode 100644
index 00000000..0f32e56d
--- /dev/null
+++ b/.github/workflows/linux-x86_64.yml
@@ -0,0 +1,57 @@
+name: "LuaJIT test workflow (Linux/x86_64)"
+
+on:
+  push:
+    branches-ignore:
+      - '**-notest'
+      - 'upstream-**'
+    tags-ignore:
+      - '**'
+
+concurrency:
+  # Update of a developer branch cancels the previously scheduled
+  # workflow run for this branch. However, the default branch,
+  # and long-term branch (tarantool-1.10, tarantool-2.8, etc.)
+  # workflow runs are never canceled.
+  #
+  # We use a trick here: define the concurrency group as 'workflow
+  # run ID' + # 'workflow run attempt' because it is a unique
+  # combination for any run. So it effectively discards grouping.
+  #
+  # XXX: we cannot use `github.sha` as a unique identifier because
+  # pushing a tag may cancel a run that works on a branch push
+  # event.
+  group: ${{ (
+    github.ref == 'refs/heads/tarantool' ||
+    startsWith(github.ref, 'refs/heads/tarantool-')) &&
+    format('{0}-{1}', github.run_id, github.run_attempt) ||
+    format('{0}-{1}', github.workflow, github.ref) }}
+  cancel-in-progress: true
+
+jobs:
+  test-linux-x86_64:
+    runs-on: ubuntu-20.04-self-hosted
+    strategy:
+      matrix:
+        BUILDTYPE:
+          - -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON
+          - -DCMAKE_BUILD_TYPE=RelWithDebInfo
+        GC64:
+          - -DLUAJIT_ENABLE_GC64=ON
+          - -DLUAJIT_ENABLE_GC64=OFF
+
+    steps:
+      - uses: actions/checkout at v2.3.4
+        with:
+          fetch-depth: 0
+          submodules: recursive
+      - name: setup
+        run: |
+          sudo apt -y update
+          sudo apt -y install cmake gcc make perl
+      - name: configure
+        run: cmake . ${{ matrix.BUILDTYPE }} ${{ matrix.GC64 }}
+      - name: build
+        run: make -j
+      - name: test
+        run: make -j test
diff --git a/.github/workflows/macos-m1.yml b/.github/workflows/macos-m1.yml
new file mode 100644
index 00000000..c34953be
--- /dev/null
+++ b/.github/workflows/macos-m1.yml
@@ -0,0 +1,66 @@
+name: "LuaJIT test workflow (macOS/M1)"
+
+on:
+  push:
+    branches-ignore:
+      - '**-notest'
+      - 'upstream-**'
+    tags-ignore:
+      - '**'
+
+concurrency:
+  # Update of a developer branch cancels the previously scheduled
+  # workflow run for this branch. However, the default branch,
+  # and long-term branch (tarantool-1.10, tarantool-2.8, etc.)
+  # workflow runs are never canceled.
+  #
+  # We use a trick here: define the concurrency group as 'workflow
+  # run ID' + # 'workflow run attempt' because it is a unique
+  # combination for any run. So it effectively discards grouping.
+  #
+  # XXX: we cannot use `github.sha` as a unique identifier because
+  # pushing a tag may cancel a run that works on a branch push
+  # event.
+  group: ${{ (
+    github.ref == 'refs/heads/tarantool' ||
+    startsWith(github.ref, 'refs/heads/tarantool-')) &&
+    format('{0}-{1}', github.run_id, github.run_attempt) ||
+    format('{0}-{1}', github.workflow, github.ref) }}
+  cancel-in-progress: true
+
+jobs:
+  test-macos-m1:
+    runs-on: macos-11-m1
+    strategy:
+      matrix:
+        BUILDTYPE:
+          - -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON
+          - -DCMAKE_BUILD_TYPE=RelWithDebInfo
+        GC64:
+          - -DLUAJIT_ENABLE_GC64=ON
+          - -DLUAJIT_ENABLE_GC64=OFF
+
+    steps:
+      - uses: actions/checkout at v2.3.4
+        with:
+          fetch-depth: 0
+          submodules: recursive
+      - name: setup
+        run: |
+          # Install brew using command from Homebrew repository instructions:
+          #   https://github.com/Homebrew/install
+          # XXX: 'echo' command below is required since brew installation
+          # script obliges the one to enter a newline for confirming the
+          # installation via Ruby script.
+          brew update ||
+            echo | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
+          # try to install the packages either upgrade it to avoid of fails
+          # if the package already exists with the previous version
+          brew install --force cmake gcc make perl ||
+            brew upgrade cmake gcc make perl
+      - name: configure
+        run: cmake . ${{ matrix.BUILDTYPE }} ${{ matrix.GC64 }}
+      - name: build
+        run: make -j
+      - name: test
+        run: make -j test
diff --git a/.github/workflows/macos-x86_64.yml b/.github/workflows/macos-x86_64.yml
new file mode 100644
index 00000000..cbf8a285
--- /dev/null
+++ b/.github/workflows/macos-x86_64.yml
@@ -0,0 +1,66 @@
+name: "LuaJIT test workflow (macOS/x86_64)"
+
+on:
+  push:
+    branches-ignore:
+      - '**-notest'
+      - 'upstream-**'
+    tags-ignore:
+      - '**'
+
+concurrency:
+  # Update of a developer branch cancels the previously scheduled
+  # workflow run for this branch. However, the default branch,
+  # and long-term branch (tarantool-1.10, tarantool-2.8, etc.)
+  # workflow runs are never canceled.
+  #
+  # We use a trick here: define the concurrency group as 'workflow
+  # run ID' + # 'workflow run attempt' because it is a unique
+  # combination for any run. So it effectively discards grouping.
+  #
+  # XXX: we cannot use `github.sha` as a unique identifier because
+  # pushing a tag may cancel a run that works on a branch push
+  # event.
+  group: ${{ (
+    github.ref == 'refs/heads/tarantool' ||
+    startsWith(github.ref, 'refs/heads/tarantool-')) &&
+    format('{0}-{1}', github.run_id, github.run_attempt) ||
+    format('{0}-{1}', github.workflow, github.ref) }}
+  cancel-in-progress: true
+
+jobs:
+  test-macos-x86_64:
+    runs-on: macos-11
+    strategy:
+      matrix:
+        BUILDTYPE:
+          - -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON
+          - -DCMAKE_BUILD_TYPE=RelWithDebInfo
+        GC64:
+          - -DLUAJIT_ENABLE_GC64=ON
+          - -DLUAJIT_ENABLE_GC64=OFF
+
+    steps:
+      - uses: actions/checkout at v2.3.4
+        with:
+          fetch-depth: 0
+          submodules: recursive
+      - name: setup
+        run: |
+          # Install brew using command from Homebrew repository instructions:
+          #   https://github.com/Homebrew/install
+          # XXX: 'echo' command below is required since brew installation
+          # script obliges the one to enter a newline for confirming the
+          # installation via Ruby script.
+          brew update ||
+            echo | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
+          # try to install the packages either upgrade it to avoid of fails
+          # if the package already exists with the previous version
+          brew install --force cmake gcc make perl ||
+            brew upgrade cmake gcc make perl
+      - name: configure
+        run: cmake . ${{ matrix.BUILDTYPE }} ${{ matrix.GC64 }}
+      - name: build
+        run: make -j
+      - name: test
+        run: make -j test
-- 
2.34.0



More information about the Tarantool-patches mailing list