quickjs-done-nextgen/.github/workflows/ci.yml

546 lines
16 KiB
YAML
Raw Normal View History

2023-10-31 17:01:52 +00:00
name: ci
on:
pull_request:
paths:
- '**'
2023-11-05 13:00:39 +00:00
- '!.gitignore'
2023-10-31 17:01:52 +00:00
- '!LICENSE'
- '!README.md'
2024-09-25 20:21:45 +00:00
- '!docs/**'
2023-10-31 17:01:52 +00:00
- '!examples/**'
- '.github/workflows/ci.yml'
push:
branches:
- master
paths:
- '**'
- '!.gitignore'
- '!LICENSE'
- '!README.md'
- '!docs/**'
- '!examples/**'
- '.github/workflows/ci.yml'
2023-10-31 17:01:52 +00:00
jobs:
codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build
run: |
make codegen
- name: Check if the git repository is clean
run: $(exit $(git status --porcelain --untracked-files=no | head -255 | wc -l)) || (echo "Dirty git tree"; git diff; exit 1)
ci:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.configType }}${{ matrix.config.arch }})
env:
ASAN_OPTIONS: halt_on_error=1
MSAN_OPTIONS: halt_on_error=1
UBSAN_OPTIONS: halt_on_error=1
defaults:
run:
shell: ${{ matrix.config.arch == '' && 'sh' || 'alpine.sh' }} {0}
2023-11-12 21:16:50 +00:00
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, configType: Debug }
- { os: ubuntu-latest, configType: Release, runTest262: true }
- { os: ubuntu-latest, configType: examples }
- { os: ubuntu-latest, configType: shared }
- { os: ubuntu-latest, configType: asan+ubsan, runTest262: true }
- { os: ubuntu-latest, configType: msan }
- { os: ubuntu-latest, configType: tcc }
- { os: ubuntu-latest, arch: x86 }
- { os: ubuntu-latest, arch: riscv64 }
- { os: ubuntu-latest, arch: s390x }
- { os: macos-14, configType: Debug }
- { os: macos-14, configType: Release }
- { os: macos-14, configType: examples }
- { os: macos-14, configType: shared }
- { os: macos-14, configType: asan+ubsan }
2023-10-31 17:01:52 +00:00
steps:
- uses: actions/checkout@v4
with:
submodules: true
# ASLR with big PIE slides does not work well with [AM]San
- name: disable ASLR
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.configType == 'asan+ubsan' || matrix.config.configType == 'msan')}}
run: |
sudo sysctl -w kernel.randomize_va_space=0
- name: install TCC
if: ${{ matrix.config.configType == 'tcc' }}
2023-11-17 22:06:02 +00:00
run: |
pushd /tmp
git clone https://repo.or.cz/tinycc.git
cd tinycc
git checkout 9d2068c6309dc50dfdbbc30a5d6757683d3f884c
./configure
2023-11-17 22:06:02 +00:00
make
sudo make install
tcc -v
popd
echo "CC=tcc" >> $GITHUB_ENV;
- name: Install extra dependencies
if: ${{ matrix.config.arch != '' }}
shell: 'sh'
run: |
sudo apt update && sudo apt install -y binfmt-support
- name: Setup Alpine
if: ${{ matrix.config.arch != '' }}
uses: jirutka/setup-alpine@v1
2024-06-07 06:29:50 +00:00
with:
arch: ${{ matrix.config.arch }}
2024-06-07 06:29:50 +00:00
packages: "build-base make cmake"
- name: Set build ENV vars
run: |
if [ "${{ matrix.config.configType }}" = "Debug" ]; then
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV;
elif [ "${{ matrix.config.configType }}" = "examples" ]; then
echo "BUILD_EXAMPLES=ON" >> $GITHUB_ENV;
elif [ "${{ matrix.config.configType }}" = "shared" ]; then
echo "BUILD_SHARED_LIBS=ON" >> $GITHUB_ENV;
elif [ "${{ matrix.config.configType }}" = "asan+ubsan" ]; then
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV;
echo "CONFIG_ASAN=ON" >> $GITHUB_ENV;
echo "CONFIG_UBSAN=ON" >> $GITHUB_ENV;
elif [ "${{ matrix.config.configType }}" = "msan" ]; then
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV;
echo "CONFIG_MSAN=ON" >> $GITHUB_ENV;
echo "CC=clang" >> $GITHUB_ENV;
fi
2024-06-07 06:29:50 +00:00
- name: build
run: |
make \
BUILD_TYPE=$BUILD_TYPE \
BUILD_EXAMPLES=$BUILD_EXAMPLES \
BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
CONFIG_ASAN=$CONFIG_ASAN \
CONFIG_UBSAN=$CONFIG_UBSAN \
CONFIG_MSAN=$CONFIG_MSAN
2024-06-07 06:29:50 +00:00
- name: stats
if: ${{ matrix.config.configType != 'examples' }}
2024-06-07 06:29:50 +00:00
run: |
make stats
- name: cxxtest
run: |
make cxxtest
2024-06-07 06:29:50 +00:00
- name: test
if: ${{ matrix.config.configType != 'examples' }}
2024-06-07 06:29:50 +00:00
run: |
make test
- name: test examples
if: ${{ matrix.config.configType == 'examples' }}
2024-03-05 08:45:47 +00:00
run: |
cp build/fib.so examples/
cp build/point.so examples/
./build/qjs examples/test_fib.js
./build/qjs examples/test_point.js
./build/qjs tests/test_bjson.js
./build/function_source
- name: test 262
if: ${{ matrix.config.runTest262 }}
2024-03-05 08:45:47 +00:00
run: |
git submodule update --init --checkout --depth 1
time make test262
- name: test standalone
run: |
./build/qjs -c examples/hello.js -o hello
./hello
windows-msvc:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
2024-06-17 07:17:21 +00:00
arch: [x64, Win32]
buildType: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: build
run: |
2024-09-10 20:47:40 +00:00
cmake -B build -DBUILD_EXAMPLES=ON -G "Visual Studio 17 2022" -A ${{matrix.arch}}
cmake --build build --config ${{matrix.buildType}}
- name: stats
run: |
build\${{matrix.buildType}}\qjs.exe -qd
- name: test
run: |
2024-09-10 20:47:40 +00:00
cp build\${{matrix.buildType}}\fib.dll examples\
cp build\${{matrix.buildType}}\point.dll examples\
build\${{matrix.buildType}}\qjs.exe examples\test_fib.js
build\${{matrix.buildType}}\qjs.exe examples\test_point.js
2024-10-10 19:51:54 +00:00
build\${{matrix.buildType}}\run-test262.exe -c tests.conf
build\${{matrix.buildType}}\function_source.exe
- name: test standalone
run: |
build\${{matrix.buildType}}\qjs.exe -c examples\hello.js -o hello.exe
.\hello.exe
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: ${{ matrix.arch == 'x64' && 'x64' || 'x86' }}
- name: cxxtest
run: |
cl.exe /DJS_NAN_BOXING=0 /Zs cxxtest.cc
cl.exe /DJS_NAN_BOXING=1 /Zs cxxtest.cc
windows-msvc-vs2019:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
arch: [x64, Win32]
buildType: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: build
run: |
cmake -B build -DBUILD_EXAMPLES=ON -G "Visual Studio 16 2019" -A ${{matrix.arch}}
cmake --build build --config ${{matrix.buildType}} --target qjs_exe
- name: stats
run: |
build\${{matrix.buildType}}\qjs.exe -qd
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: ${{ matrix.arch == 'x64' && 'x64' || 'x86' }}
- name: cxxtest
run: |
cl.exe /DJS_NAN_BOXING=0 /Zs cxxtest.cc
cl.exe /DJS_NAN_BOXING=1 /Zs cxxtest.cc
windows-clang:
runs-on: windows-latest
2023-11-30 08:13:35 +00:00
strategy:
fail-fast: false
matrix:
buildType: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: build
run: |
git submodule update --init --checkout --depth 1
2024-09-10 20:47:40 +00:00
cmake -B build -DBUILD_EXAMPLES=ON -G "Visual Studio 17 2022" -T ClangCL
cmake --build build --config ${{matrix.buildType}}
- name: stats
run: |
2024-04-06 20:28:52 +00:00
build\${{matrix.buildType}}\qjs.exe -qd
- name: cxxtest
run: |
clang-cl.exe /DJS_NAN_BOXING=0 /Zs cxxtest.cc
clang-cl.exe /DJS_NAN_BOXING=1 /Zs cxxtest.cc
- name: test
run: |
2024-09-10 20:47:40 +00:00
cp build\${{matrix.buildType}}\fib.dll examples\
cp build\${{matrix.buildType}}\point.dll examples\
build\${{matrix.buildType}}\qjs.exe examples\test_fib.js
build\${{matrix.buildType}}\qjs.exe examples\test_point.js
2024-10-10 19:51:54 +00:00
build\${{matrix.buildType}}\run-test262.exe -c tests.conf
2024-04-06 20:28:52 +00:00
build\${{matrix.buildType}}\function_source.exe
2024-04-06 20:42:01 +00:00
windows-ninja:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
buildType: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: install ninja
run: |
choco install ninja
ninja.exe --version
- name: build
run: |
git submodule update --init --checkout --depth 1
2024-09-10 20:47:40 +00:00
cmake -B build -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=${{matrix.buildType}} -G "Ninja"
cmake --build build
2024-04-06 20:42:01 +00:00
- name: stats
run: |
build\qjs.exe -qd
- name: test
run: |
2024-09-10 20:47:40 +00:00
cp build\fib.dll examples\
cp build\point.dll examples\
build\qjs.exe examples\test_fib.js
build\qjs.exe examples\test_point.js
2024-10-10 19:51:54 +00:00
build\run-test262.exe -c tests.conf
2024-04-06 20:42:01 +00:00
build\function_source.exe
2024-11-18 09:06:27 +00:00
windows-sdk:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch: [x64, Win32]
buildType: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: Install windows sdk
uses: ChristopheLav/windows-sdk-install@v1
with:
version-sdk: 26100
features: 'OptionId.DesktopCPPx86,OptionId.DesktopCPPx64'
- name: build
run: |
cmake -B build -DBUILD_EXAMPLES=ON -DCMAKE_SYSTEM_VERSION="10.0.26100.0" -A ${{matrix.arch}}
cmake --build build --config ${{matrix.buildType}}
- name: stats
run: |
build\${{matrix.buildType}}\qjs.exe -qd
- name: test
run: |
cp build\${{matrix.buildType}}\fib.dll examples\
cp build\${{matrix.buildType}}\point.dll examples\
build\${{matrix.buildType}}\qjs.exe examples\test_fib.js
build\${{matrix.buildType}}\qjs.exe examples\test_point.js
build\${{matrix.buildType}}\run-test262.exe -c tests.conf
build\${{matrix.buildType}}\function_source.exe
2023-11-06 22:15:19 +00:00
windows-mingw:
2023-11-02 08:33:13 +00:00
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
buildType: [Debug, Release]
2023-11-02 08:33:13 +00:00
sys:
2023-11-24 12:58:20 +00:00
- mingw32
2023-11-02 08:33:13 +00:00
- mingw64
- clang64
2023-11-02 08:33:13 +00:00
- ucrt64
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
2023-11-02 08:33:13 +00:00
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
install: >-
git
make
pacboy: >-
cmake:p
ninja:p
toolchain:p
- name: build
run: |
make BUILD_TYPE=${{matrix.buildType}}
2023-11-02 08:33:13 +00:00
- name: stats
run: |
make stats
ldd build/qjs
- name: cxxtest
if: ${{ matrix.sys != 'clang64' }}
run: |
make cxxtest
- name: cxxtest
if: ${{ matrix.sys == 'clang64' }}
run: |
make cxxtest CXX=clang++
- name: test
run: |
make test
- name: test standalone
run: |
./build/qjs -c examples/hello.js -o hello.exe
./hello
windows-mingw-shared:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
install: >-
git
make
pacboy: >-
cmake:p
ninja:p
toolchain:p
- name: build
run: |
make BUILD_SHARED_LIBS=ON
ldd build/qjs
- name: stats
run: |
make stats
emscripten:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v13
- name: check emsdk
run: emcc -v
- name: build
run: |
emcmake cmake -B build -DBUILD_QJS_LIBC=ON
emmake make -C build qjs_wasm -j$(getconf _NPROCESSORS_ONLN)
- name: result
run: ls -lh build
2024-02-13 11:43:56 +00:00
wasi:
runs-on: ubuntu-latest
2024-02-13 11:43:56 +00:00
steps:
- uses: actions/checkout@v4
2024-02-13 11:43:56 +00:00
- uses: jcbhmr/setup-wasmtime@v2
- name: setup wasi-sdk
run: |
wget -nv https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk_21.0_amd64.deb -P /tmp
2024-02-13 11:43:56 +00:00
sudo apt install /tmp/wasi-sdk*.deb
- name: test
run: |
cmake -B build -DCMAKE_TOOLCHAIN_FILE=/opt/wasi-sdk/share/cmake/wasi-sdk.cmake
make -C build qjs_exe
wasmtime run build/qjs -qd
echo "console.log('hello wasi!');" > t.js
wasmtime run --dir . build/qjs t.js
2023-12-03 17:15:07 +00:00
cygwin:
runs-on: windows-latest
defaults:
run:
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
2023-12-07 08:26:11 +00:00
env:
CYGWIN_NOWINPATH: 1
CHERE_INVOKING: 1
2023-12-03 17:15:07 +00:00
steps:
- name: Set up Cygwin
uses: cygwin/cygwin-install-action@master
with:
packages: make cmake gcc-g++ bash
- uses: actions/checkout@v4
2023-12-03 17:15:07 +00:00
- name: build
2023-12-07 08:26:11 +00:00
run: make
2023-12-03 17:15:07 +00:00
- name: stats
2023-12-07 08:26:11 +00:00
run: make stats
2023-12-03 17:15:07 +00:00
- name: cxxtest
run: |
make cxxtest
2023-12-03 17:15:07 +00:00
- name: test
2023-12-07 08:26:11 +00:00
run: make test
2023-12-04 22:18:41 +00:00
openbsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2023-12-04 22:18:41 +00:00
- name: build + test
uses: vmactions/openbsd-vm@v1
with:
usesh: true
prepare: |
2023-12-07 08:13:21 +00:00
pkg_add cmake gmake
2023-12-04 22:18:41 +00:00
run: |
2023-12-07 08:13:21 +00:00
gmake
gmake stats
2023-12-05 08:14:12 +00:00
freebsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2023-12-05 08:14:12 +00:00
- name: build + test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
2023-12-07 08:13:21 +00:00
pkg install -y cmake gmake
2023-12-05 08:14:12 +00:00
run: |
2023-12-07 08:13:21 +00:00
gmake
gmake stats
2023-12-07 14:48:31 +00:00
2024-03-12 07:09:59 +00:00
android:
runs-on: ubuntu-latest
2024-03-12 07:09:59 +00:00
container: reactnativecommunity/react-native-android:v13.0
steps:
- uses: actions/checkout@v4
- name: Configure android arm64
# see build options you can use in https://developer.android.com/ndk/guides/cmake
run: |
mkdir build
cd build
$ANDROID_HOME/cmake/3.22.1/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/26.0.10792818/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 -DBUILD_QJS_LIBC=ON ..
2024-03-12 07:09:59 +00:00
- name: Build android arm64
run: |
$ANDROID_HOME/cmake/3.22.1/bin/cmake --build build --target qjs
ls -lh build
2024-04-12 10:24:18 +00:00
ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: configure
run: |
cmake -B build -GXcode -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DBUILD_QJS_LIBC=ON
- name: build
run: |
cmake --build build --config Release --target qjs
ls -lh build
mimalloc-linux:
runs-on: ubuntu-24.04
env:
BUILD_CLI_WITH_MIMALLOC: ON
MIMALLOC_SHOW_STATS: 1
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
sudo apt update && sudo apt -y install libmimalloc-dev
- name: build
run: |
make
- name: cxxtest
run: |
make cxxtest
- name: test
run: |
make test
mimalloc-macos:
runs-on: macos-latest
env:
BUILD_CLI_WITH_STATIC_MIMALLOC: ON
MIMALLOC_SHOW_STATS: 1
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
brew install mimalloc
- name: build
run: |
make
- name: cxxtest
run: |
make cxxtest
- name: test
run: |
make test