Raise CI runner to ubuntu 22.04 (#4191)

update workflows and scripts for Ubuntu 22.04 compatibility. It includes
  - install Intel SGX SDK 2.25
  - use a reusable action to install sgx required
  - keep improve error handling in AOT compilation process in runtest.py

add a workaround to fix receiving a shutdown signal problem. Refers to https://github.com/actions/runner-images/issues/6680 and https://github.com/actions/runner-images/discussions/7188
This commit is contained in:
liang.he 2025-04-17 15:07:46 +08:00 committed by GitHub
parent 955fce5664
commit fc1527eacd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 122 additions and 201 deletions

View File

@ -0,0 +1,47 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Always follow https://download.01.org/intel-sgx/latest/linux-latest/docs/
name: "Install Intel SGX SDK"
description: "Installs the Intel SGX SDK and necessary libraries for Ubuntu."
author: "Intel Corporation"
inputs:
os:
description: "Operating system to install on (ubuntu-22.04)"
required: true
runs:
using: "composite"
steps:
- name: Check Runner OS
if: ${{ inputs.os != 'ubuntu-22.04' }}
shell: bash
run: |
echo "::error title=⛔ error hint::Only support ubuntu-22.04 for now"
exit 1
- name: Create installation directory
shell: bash
run: sudo mkdir -p /opt/intel
- name: Download and install SGX SDK on ubuntu-22.04
if: ${{ inputs.os == 'ubuntu-22.04' }}
shell: bash
run: |
sudo wget -O sgx_linux_x64_sdk.bin https://download.01.org/intel-sgx/sgx-linux/2.25/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.25.100.3.bin
sudo chmod +x sgx_linux_x64_sdk.bin
echo 'yes' | sudo ./sgx_linux_x64_sdk.bin
working-directory: /opt/intel
- name: Add SGX repository and install libraries
shell: bash
run: |
echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
sudo apt update
sudo apt install -y libsgx-launch libsgx-urts
- name: Source SGX SDK environment
shell: bash
run: source /opt/intel/sgxsdk/environment

View File

@ -89,14 +89,6 @@ jobs:
./core/deps/llvm/build/share
key: ${{ steps.create_lib_cache_key.outputs.key}}
- uses: actions/cache@v4
with:
path: ~/.ccache
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
restore-keys: |
0-ccache-${{ inputs.os }}
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-20.04'
- uses: actions/cache@v4
with:
path: ~/.cache/ccache

View File

@ -19,7 +19,7 @@ permissions:
jobs:
compliance_job:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4

View File

@ -53,6 +53,10 @@ env:
FAST_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=1"
LLVM_LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
# For Spec Test
DEFAULT_TEST_OPTIONS: "-s spec -x -p -b"
SIMD_TEST_OPTIONS: "-s spec -x -p -b -S"
XIP_TEST_OPTIONS: "-s spec -x -p -b -X"
permissions:
contents: read
@ -64,7 +68,7 @@ jobs:
actions: write
uses: ./.github/workflows/build_llvm_libraries.yml
with:
os: "ubuntu-20.04"
os: ubuntu-22.04
arch: "X86"
build_iwasm:
@ -102,7 +106,7 @@ jobs:
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
"-DWAMR_BUILD_SGX_IPFS=1",
]
os: [ubuntu-20.04]
os: [ubuntu-22.04]
platform: [linux-sgx]
exclude:
# incompatible mode and feature
@ -110,22 +114,14 @@ jobs:
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
steps:
- name: install SGX SDK and necessary libraries
run: |
mkdir -p /opt/intel
cd /opt/intel
wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin
chmod +x sgx_linux_x64_sdk_2.15.100.3.bin
echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin
echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
sudo apt update
sudo apt install -y libsgx-launch libsgx-urts
source /opt/intel/sgxsdk/environment
- name: checkout
uses: actions/checkout@v4
- name: install SGX SDK and necessary libraries
uses: ./.github/actions/install-linux-sgx
with:
os: ${{ matrix.os }}
- name: Build iwasm
run: |
mkdir build && cd build
@ -150,7 +146,7 @@ jobs:
#$LLVM_LAZY_JIT_BUILD_OPTIONS,
#$LLVM_EAGER_JIT_BUILD_OPTIONS,
]
os: [ubuntu-20.04]
os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz",
@ -165,7 +161,7 @@ jobs:
]
platform: [linux-sgx]
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
steps:
@ -186,33 +182,10 @@ jobs:
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo mv wabt-1.0.31 wabt
- name: build wasi-libc (needed for wasi-threads)
run: |
mkdir wasi-libc
cd wasi-libc
git init
# "Fix a_store operation in atomic.h" commit on main branch
git fetch https://github.com/WebAssembly/wasi-libc \
1dfe5c302d1c5ab621f7abf04620fae92700fd22
git checkout FETCH_HEAD
make \
AR=/opt/wasi-sdk/bin/llvm-ar \
NM=/opt/wasi-sdk/bin/llvm-nm \
CC=/opt/wasi-sdk/bin/clang \
THREAD_MODEL=posix
working-directory: core/deps
- name: install SGX SDK and necessary libraries
run: |
mkdir -p /opt/intel
cd /opt/intel
wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin
chmod +x sgx_linux_x64_sdk_2.15.100.3.bin
echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin
echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
sudo apt update
sudo apt install -y libsgx-launch libsgx-urts
uses: ./.github/actions/install-linux-sgx
with:
os: ${{ matrix.os }}
- name: Build iwasm for testing samples
run: |
@ -271,28 +244,32 @@ jobs:
spec_test_default:
needs: [build_iwasm, build_llvm_libraries]
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
strategy:
matrix:
running_mode: ["classic-interp", "fast-interp", "aot", "fast-jit"]
# FIXME: use binary release(adding -b) instead of building from source after upgrading to 22.04
test_option: ["-x -p -s spec -P", "-x -p -s spec -S -P", "-x -p -s spec -X -P"]
llvm_cache_key: ["${{ needs.build_llvm_libraries.outputs.cache_key }}"]
#(workaround) disable "fast-interp" because of SIMDE
running_mode: ["classic-interp", "aot", "fast-jit"]
test_option:
[$DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS, $XIP_TEST_OPTIONS]
os: [ubuntu-22.04]
exclude:
# classic-interp, fast-interp and fast-jit don't support simd
- running_mode: "classic-interp"
test_option: "-x -p -s spec -S -P"
test_option: $SIMD_TEST_OPTIONS
- running_mode: "fast-interp"
test_option: "-x -p -s spec -S -P"
test_option: $SIMD_TEST_OPTIONS
- running_mode: "fast-jit"
test_option: "-x -p -s spec -S -P"
test_option: $SIMD_TEST_OPTIONS
# classic-interp, fast-interp and fast jit don't support XIP
- running_mode: "classic-interp"
test_option: "-x -p -s spec -X -P"
test_option: $XIP_TEST_OPTIONS
- running_mode: "fast-interp"
test_option: "-x -p -s spec -X -P"
test_option: $XIP_TEST_OPTIONS
- running_mode: "fast-jit"
test_option: "-x -p -s spec -X -P"
test_option: $XIP_TEST_OPTIONS
include:
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
steps:
- name: checkout
@ -316,19 +293,19 @@ jobs:
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install SGX SDK and necessary libraries
run: |
mkdir -p /opt/intel
cd /opt/intel
wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin
chmod +x sgx_linux_x64_sdk_2.15.100.3.bin
echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin
echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
sudo apt update
sudo apt install -y libsgx-launch libsgx-urts
uses: ./.github/actions/install-linux-sgx
with:
os: ${{ matrix.os }}
- name: install for wabt compilation
run: sudo apt update && sudo apt install -y ninja-build
#workaround about a https://github.com/actions/runner-images/issues/6680#issuecomment-2640923706
- name: Increase swapfile
run: |
sudo swapoff -a
sudo fallocate -l 15G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
- name: run spec tests
run: |

View File

@ -48,15 +48,7 @@ permissions:
contents: read
jobs:
build_llvm_libraries_on_ubuntu_2004:
permissions:
contents: read
actions: write
uses: ./.github/workflows/build_llvm_libraries.yml
with:
os: "ubuntu-20.04"
arch: "X86"
build_llvm_libraries_on_ubuntu_2204:
build_llvm_libraries_on_ubuntu:
permissions:
contents: read
actions: write
@ -66,16 +58,13 @@ jobs:
arch: "X86"
build_wamrc:
needs:
[
build_llvm_libraries_on_ubuntu_2004,
]
needs: build_llvm_libraries_on_ubuntu
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
steps:
- name: checkout
uses: actions/checkout@v4
@ -106,10 +95,7 @@ jobs:
working-directory: wamr-compiler
build_iwasm:
needs:
[
build_llvm_libraries_on_ubuntu_2004,
]
needs: build_llvm_libraries_on_ubuntu
runs-on: ${{ matrix.os }}
strategy:
matrix:
@ -144,7 +130,7 @@ jobs:
"-DWAMR_BUILD_MULTI_MEMORY=1",
"-DWAMR_BUILD_SHARED=1",
]
os: [ubuntu-20.04]
os: [ubuntu-22.04]
platform: [android, linux]
exclude:
# incompatible feature and platform
@ -241,8 +227,8 @@ jobs:
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
platform: android
include:
- os: ubuntu-20.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
steps:
- name: checkout
@ -375,12 +361,7 @@ jobs:
working-directory: wamr/product-mini/platforms/linux
build_samples_wasm_c_api:
needs:
[
build_iwasm,
build_llvm_libraries_on_ubuntu_2004,
build_wamrc,
]
needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@ -396,7 +377,7 @@ jobs:
$LLVM_EAGER_JIT_BUILD_OPTIONS,
$MULTI_TIER_JIT_BUILD_OPTIONS,
]
os: [ubuntu-20.04]
os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
@ -406,8 +387,8 @@ jobs:
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include:
- os: ubuntu-20.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
exclude:
- make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
sanitizer: asan
@ -457,16 +438,11 @@ jobs:
working-directory: samples/wasm-c-api
build_samples_others:
needs:
[
build_iwasm,
build_llvm_libraries_on_ubuntu_2004,
build_wamrc,
]
needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
@ -476,8 +452,8 @@ jobs:
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include:
- os: ubuntu-20.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
steps:
- name: checkout
uses: actions/checkout@v4
@ -613,18 +589,12 @@ jobs:
./shared_heap_test --aot
test:
needs:
[
build_iwasm,
build_llvm_libraries_on_ubuntu_2004,
build_llvm_libraries_on_ubuntu_2204,
build_wamrc,
]
needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
os: [ubuntu-22.04]
sanitizer: ["", "ubsan", "asan", "tsan"]
running_mode:
[
@ -648,17 +618,11 @@ jobs:
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
]
include:
- os: ubuntu-20.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
ubuntu_version: "20.04"
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
ubuntu_version: "22.04"
exclude:
# incompatible modes and features
- os: ubuntu-20.04
sanitizer: tsan
# asan works only for aot now
- running_mode: "classic-interp"
sanitizer: asan

View File

@ -58,16 +58,6 @@ jobs:
#
# LLVM_LIBRARIES
build_llvm_libraries_on_ubuntu_2004:
permissions:
contents: read
actions: write
needs: [create_tag, create_release]
uses: ./.github/workflows/build_llvm_libraries.yml
with:
os: "ubuntu-20.04"
arch: "AArch64 ARM Mips RISCV X86"
build_llvm_libraries_on_ubuntu_2204:
permissions:
contents: read
@ -100,18 +90,6 @@ jobs:
#
# WAMRC
release_wamrc_on_ubuntu_2004:
permissions:
contents: write # upload release artifact
needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2004]
uses: ./.github/workflows/build_wamrc.yml
with:
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
release: true
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_wamrc_on_ubuntu_2204:
permissions:
contents: write # upload release artifact
@ -150,18 +128,6 @@ jobs:
#
# IWASM
release_iwasm_on_ubuntu_2004:
permissions:
contents: write # upload release artifact
needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2004]
uses: ./.github/workflows/build_iwasm_release.yml
with:
cwd: product-mini/platforms/linux
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_iwasm_on_ubuntu_2204:
permissions:
contents: write # upload release artifact
@ -200,19 +166,6 @@ jobs:
#
# WAMR_SDK
release_wamr_sdk_on_ubuntu_2004:
permissions:
contents: write # upload release artifact
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_sdk.yml
with:
config_file: wamr_config_ubuntu_release.cmake
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz
wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git
release_wamr_sdk_on_ubuntu_2204:
permissions:
contents: write # upload release artifact
@ -264,16 +217,6 @@ jobs:
#
# WAMR_LLDB
release_wamr_lldb_on_ubuntu_2004:
permissions:
contents: write # upload release artifact
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_lldb.yml
with:
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_wamr_lldb_on_ubuntu_2204:
permissions:
contents: write # upload release artifact

View File

@ -13,8 +13,8 @@ import subprocess
import sys
import unittest
CLANG_FORMAT_CMD = "clang-format-12"
GIT_CLANG_FORMAT_CMD = "git-clang-format-12"
CLANG_FORMAT_CMD = "clang-format-14"
GIT_CLANG_FORMAT_CMD = "git-clang-format-14"
# glob style patterns
EXCLUDE_PATHS = [
@ -32,7 +32,7 @@ EXCLUDE_PATHS = [
"**/tests/wamr-test-suites/workspace/*",
]
C_SUFFIXES = [".c", ".cpp", ".h"]
C_SUFFIXES = [".c", ".cc", ".cpp", ".h"]
INVALID_DIR_NAME_SEGMENT = r"([a-zA-Z0-9]+\_[a-zA-Z0-9]+)"
INVALID_FILE_NAME_SEGMENT = r"([a-zA-Z0-9]+\-[a-zA-Z0-9]+)"
@ -93,20 +93,19 @@ def run_clang_format(file_path: Path, root: Path) -> bool:
def run_clang_format_diff(root: Path, commits: str) -> bool:
"""
Use `clang-format-12` or `git-clang-format-12` to check code format of
Use `clang-format-14` or `git-clang-format-14` to check code format of
the PR, with a commit range specified. It is required to format the
code before committing the PR, or it might fail to pass the CI check:
1. Install clang-format-12.0.0
Normally we can install it by `sudo apt-get install clang-format-12`,
or download the `clang+llvm-12.0.0-xxx-tar.xz` package from
https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.0
1. Install clang-format-14.0.0
Normally we can install it by `sudo apt-get install clang-format-14`,
or download the package from https://github.com/llvm/llvm-project/releases
and install it
2. Format the C/C++ source file
``` shell
cd path/to/wamr/root
clang-format-12 --style file -i path/to/file
clang-format-14 --style file -i path/to/file
```
The code wrapped by `/* clang-format off */` and `/* clang-format on */`

View File

@ -1541,11 +1541,10 @@ if __name__ == "__main__":
if test_aot:
new_module_aot = os.path.join(tempfile.gettempdir(), name_new + ".aot")
r = compile_wasm_to_aot(new_module, new_module_aot, True, opts, r)
try:
assert_prompt(r, ['Compile success'], opts.start_timeout, True)
except:
raise Exception("compile wasm to aot failed")
compile_wasm_to_aot(new_module, new_module_aot, None, opts, r)
except Exception as e:
raise Exception(f"compile wasm to aot failed. {e}")
# add aot module into temp_file_repo[]
temp_file_repo.append(new_module_aot)
else:

View File

@ -361,7 +361,7 @@ function sightglass_test()
function setup_wabt()
{
WABT_VERSION=1.0.36
WABT_VERSION=1.0.37
if [ ${WABT_BINARY_RELEASE} == "YES" ]; then
echo "download a binary release and install"
local WAT2WASM=${WORK_DIR}/wabt/out/gcc/Release/wat2wasm