Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build,test: add .ci.yml for containered tests (WIP proposal) #30057

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
267 changes: 267 additions & 0 deletions .ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
# Configuration for ci.nodejs.org
#
# `linux-x64-container-suite` list tests that are to be run in:
# https://ci.nodejs.org/job/rv-test-commit-linux-docker
# using container images found at:
# https://github.com/rvagg/node-ci-containers
#
# Each test in this list needs to be defined under the `tests` list and needs:
# - a `label` that will be used to report to GitHub in the pull request status
# checks.
# - an `image` that corresponds to one of the images found in
# https://github.com/rvagg/node-ci-containers such that it can be pulled
# from Docker Hub as `rvagg/node-ci-containers:$image`.
# - an `execute` block that contains Bash that performs the build & test steps
# required for this build type.
#
# Images are assumed to contain the required packages and data needed to
# perform the build & test steps, while the execution of those steps are
# defined here.
#
# Execution is limited to the `iojs` user in each container, beginning in the
# /home/iojs/workspace directory which maps to the current Jenkins workspace on
# the host.

linux_x64_container_suite:
- lint
- ubuntu1804
- ubuntu1910
- ubuntu1604-gcc6
- debian9
- centos7-devtoolset7
- centos8
- centos8-python2
- fedora30
- alpine310
- zlib
- openssl111
- withoutintl
- withoutssl
- shared
- debug
- ninja
- workers

tests:
lint:
label: Lint JS, C++, Python, Markdown & Docs
image: node-linter
execute: |
make lint-py-build PYTHON=python3
make lint-py PYTHON=python3
make lint-py-build PYTHON=python2
make lint-ci PYTHON=python2 || {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't PYTHON be defined before running make instead of after?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do either.

PYTHON=python2 make lint-ci

Sets the PYTHON environment variable in the shell and runs make, which turns environment variables into make variables: https://www.gnu.org/software/make/manual/html_node/Environment.html#Environment

make lint-ci PYTHON=python2

Overrides the make variable from the command line: https://www.gnu.org/software/make/manual/html_node/Overriding.html

cat test-eslint.tap | grep -v '^ok\|^TAP version 13\|^1\.\.' | sed '/^\s*$/d' &&
exit 1; }

ubuntu1804:
label: Ubuntu 18.04 (Bionic) Container
image: ubuntu1804
execute: |
make run-ci -j $JOBS V=

# Should be removed when 20.04 is added, or mid-2020, whichever comes first
ubuntu1910:
label: Ubuntu 19.10 (Eoan) Container
image: ubuntu1910
execute: |
make run-ci -j $JOBS V=

ubuntu1604-gcc6:
label: Ubuntu 16.04 (Bionic) with GCC 6 Container
image: ubuntu1604-gcc6
execute: |
make run-ci -j $JOBS V=

debian9:
label: Debian 9 (Stretch) Container
image: debian9
execute: |
make run-ci -j $JOBS V=

centos7-devtoolset7:
label: CentOS 7 with Devtoolset-7 Container
image: centos7-devtoolset7
execute: |
make run-ci -j $JOBS V=

centos8:
label: CentOS 8 Container
image: centos8
execute: |
export PYTHON=python3
make run-ci -j $JOBS V=

# Other containers have Python 2, this provides a comparison to the bare
# CentOS 8 run that strictly just contains `python3`.
# Should be removed when we are more confident with Python 2+3 support.
centos8-python2:
label: CentOS 8 Container with Python 2
image: centos8-python2
execute: |
export PYTHON=python2
make run-ci -j $JOBS V=

# Should be removed mid-2020 when support ceases
fedora30:
label: Fedora 30 Container
image: fedora30
execute: |
make run-ci -j $JOBS V=

# Should be removed mid-2021 or earlier
alpine310:
label: Alpine 3.10 Container
image: alpine310
execute: |
make run-ci -j $JOBS V=

zlib:
label: Linux --shared-zlib
image: ubuntu1804-zlib
execute: |
export CONFIG_FLAGS="$CONFIG_FLAGS --shared-zlib --shared-zlib-includes=${ZLIB12DIR}/include/ --shared-zlib-libpath=${ZLIB12DIR}/lib/"
make run-ci -j $JOBS V=

ZLIB_VERSION="$(out/Release/node -pe process.versions | grep zlib)"
echo "zlib Version: $ZLIB_VERSION"
if [ X"$(echo $ZLIB_VERSION | grep 1\.2\.11)" = X"" ]; then
FAIL_MSG="Not built with zlib 1.2.11"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > zlib-test.tap
exit 1
fi

openssl111:
label: Linux --shared-openssl with OpenSSL 1.1.1
image: ubuntu1804-openssl111
execute: |
export LD_LIBRARY_PATH=${OPENSSL111DIR}/lib/
export PATH=${OPENSSL111DIR}/bin/:$PATH
export CONFIG_FLAGS="$CONFIG_FLAGS --shared-openssl --shared-openssl-includes=${OPENSSL111DIR}/include/ --shared-openssl-libpath=${OPENSSL111DIR}/lib/"
make run-ci -j $JOBS V=

OPENSSL_VERSION="$(out/Release/node -pe 'process.versions.openssl')"
echo "OpenSSL Version: $OPENSSL_VERSION"
if [ X"$(echo $OPENSSL_VERSION | grep 1\.1\.1)" = X"" ]; then
FAIL_MSG="Not built with OpenSSL 1.1.1"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > openssl111-test.tap
exit 1
fi
OPENSSL_LIB="$(out/Release/node -pe 'process.config.target_defaults.libraries[0]')"
echo "OpenSSL link: $OPENSSL_LIB"
if [ X"$(echo $OPENSSL_LIB | grep 1\.1\.1)" = X"" ]; then
FAIL_MSG="Not linked against OpenSSL 1.1.1"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > openssl111-test.tap
exit 1
fi

withoutintl:
label: Linux --without-intl
image: ubuntu1804
execute: |
export CONFIG_FLAGS="$CONFIG_FLAGS --without-intl"
make run-ci -j $JOBS V=

INTL_OBJECT="$(out/Release/node -pe 'typeof Intl')"
echo "Intl object type: $INTL_OBJECT"
if [ X"$INTL_OBJECT" != X"undefined" ]; then
FAIL_MSG="Has an Intl object"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > withoutintl-test.tap
exit 1
fi
PROCESS_VERSIONS_INTL="$(out/Release/node -pe process.versions.icu)"
echo "process.versions.icu: $PROCESS_VERSIONS_INTL"
if [ X"$PROCESS_VERSIONS_INTL" != X"undefined" ]; then
FAIL_MSG="process.versions.icu not undefined"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > withoutintl-test.tap
exit 1
fi

withoutssl:
label: Linux --without-ssl
image: ubuntu1804
execute: |
export CONFIG_FLAGS="$CONFIG_FLAGS --without-ssl"
make run-ci -j $JOBS V=

HAS_OPENSSL="$(out/Release/node -p 'Boolean(process.versions.openssl)')"
echo "Has OpenSSL: $HAS_OPENSSL"
if [ X"$HAS_OPENSSL" != X"false" ]; then
FAIL_MSG="Has an OpenSSL"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > withoutssl-test.tap
exit 1
fi
out/Release/node -p 'require("crypto")' || REQUIRE_CRYPTO="no crypto"
if [ "$REQUIRE_CRYPTO" != "no crypto" ]; then
FAIL_MSG='require("crypto") did not fail'
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > withoutssl-test.tap
exit 1
fi

shared:
label: Linux --shared
image: ubuntu1804
execute: |
export CONFIG_FLAGS="$CONFIG_FLAGS --shared"
make run-ci -j $JOBS V=

debug:
label: Linux Debug
image: ubuntu1804
execute: |
export CONFIG_FLAGS="$CONFIG_FLAGS --debug"

# see https://github.com/nodejs/node/issues/17016
sed -i 's/\[\$system==linux\]/[$system==linux]\ntest-error-reporting : PASS, FLAKY/g' test/parallel/parallel.status
# see https://github.com/nodejs/node/issues/17017
sed -i 's/\[\$system==linux\]/[$system==linux]\ntest-inspector-async-stack-traces-promise-then : PASS, FLAKY/g' test/sequential/sequential.status
# see https://github.com/nodejs/node/issues/17018
sed -i 's/\[\$system==linux\]/[$system==linux]\ntest-inspector-contexts : PASS, FLAKY/g' test/sequential/sequential.status

make build-ci -j $JOBS V=

if ! [ -x out/Debug/node ]; then
FAIL_MSG="No Debug executable"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > debug-test.tap
exit 1
fi

BUILD_TYPE="$(out/Debug/node -pe process.config.target_defaults.default_configuration)"
echo "Build type: $BUILD_TYPE"
if [ X"$BUILD_TYPE" != X"Debug" ]; then
FAIL_MSG="Not built as Debug"
echo "Error: $FAIL_MSG"
echo -e "TAP version 13\n1..1\nnot ok 1 $FAIL_MSG\n ---\n duration_ms: 0\n ..." > debug-test.tap
exit 1
fi

python tools/test.py -j $JOBS -p tap --logfile test.tap \
--mode=debug --flaky-tests=$FLAKY_TESTS \
async-hooks default known_issues

ninja:
label: Linux Ninja
image: ubuntu1804
execute: |
export CC=/usr/lib/ccache/cc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to write those two as env variable in docker image ?

export CXX=/usr/lib/ccache/c++
python ./configure --verbose --ninja
gengjiawen marked this conversation as resolved.
Show resolved Hide resolved
ninja -C out/Release -j $JOBS
python tools/test.py -j $JOBS -p tap --logfile test.tap \
--flaky-tests=$FLAKY_TESTS async-hooks default known_issues

workers:
label: Linux Worker Test Suite
image: ubuntu1804
execute: |
make build-ci -j $JOBS V=
python tools/test.py -j $JOBS -p tap --logfile test.tap \
--flaky-tests=$FLAKY_TESTS --worker default
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
!.nycrc
!.eslintrc.yaml
!.cpplint
!.ci.yml

# === Rules for root dir ===
/core
Expand Down
98 changes: 0 additions & 98 deletions test/wasi/test-wasi.js

This file was deleted.