Circleci project setup (#3055)
* Add .circleci/config.yml * setup config * use jdk8 image * Updated config.yml * Updated config.yml * Updated config.yml * more targets * Updated config.yml * update config * update config * update config * update config * update config * Updated config.yml * Updated config.yml * Updated config.yml * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update runtime version * update config * update config * python3 config * update config * align Python2 and Python3 test hierarchy * update runtime version * update config * update config * update config * update config * explore dart issue * update dart installer * update config * update dart installer * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * use sudo on circle ci * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * Fix NPE * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * update config * more consistent badges * do not parallelize tests on circle-ci
This commit is contained in:
parent
84d8348dc1
commit
bca2536f3f
|
@ -0,0 +1,66 @@
|
|||
version: 2.1
|
||||
|
||||
jobs:
|
||||
test_tool_and_runtime_java:
|
||||
docker:
|
||||
- image: cimg/openjdk:8.0
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: build tool
|
||||
command: mvn -B -V -DskipTests=true -Dmaven.javadoc.skip=true install
|
||||
- run:
|
||||
name: test runtime
|
||||
command: |
|
||||
cd runtime-testsuite
|
||||
mvn -q -Dparallel=methods -DthreadCount=4 -Dtest=java.* test
|
||||
cd ..
|
||||
- run:
|
||||
name: test tool
|
||||
command: |
|
||||
cd tool-testsuite
|
||||
mvn -q -Dparallel=methods -DthreadCount=4 test
|
||||
cd ..
|
||||
test_runtime:
|
||||
parameters:
|
||||
test-group:
|
||||
description: The section
|
||||
type: string
|
||||
default: ALL
|
||||
target:
|
||||
description: The target
|
||||
type: string
|
||||
default: java
|
||||
docker:
|
||||
- image: cimg/openjdk:8.0
|
||||
environment:
|
||||
TARGET: << parameters.target >>
|
||||
GROUP: << parameters.test-group >>
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install << parameters.target >> pre-requisites
|
||||
command: |
|
||||
f=".circleci/scripts/install-linux-<< parameters.target >>.sh"; ! [ -x "$f" ] || "$f"
|
||||
- run:
|
||||
name: Build ANTLR4 tool
|
||||
command: mvn -B -V -DskipTests=true -Dmaven.javadoc.skip=true install
|
||||
- run:
|
||||
name: Test << parameters.target >> runtime
|
||||
command: |
|
||||
.circleci/scripts/run-tests-<< parameters.target >>.sh
|
||||
|
||||
workflows:
|
||||
build:
|
||||
jobs:
|
||||
- test_tool_and_runtime_java
|
||||
- test_runtime:
|
||||
matrix:
|
||||
parameters:
|
||||
target: [ dart, go, python2, python3, javascript ]
|
||||
- test_runtime:
|
||||
matrix:
|
||||
parameters:
|
||||
# target: [ cpp, dotnet, swift ]
|
||||
target: [ cpp, dotnet ]
|
||||
test-group: [ LEXER, PARSER, RECURSION ]
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "installing cpp SDK..."
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y clang
|
||||
sudo apt-get install -y cmake
|
||||
sudo apt-get install -y pkg-config
|
||||
sudo apt-get install -y uuid-dev
|
||||
|
||||
echo "done installing cpp SDK"
|
||||
|
||||
clang++ --version
|
||||
cmake --version
|
||||
|
||||
echo "building cpp runtime..."
|
||||
|
||||
pushd "runtime/Cpp/"
|
||||
echo $PWD
|
||||
rc=0
|
||||
if [ $rc == 0 ]; then
|
||||
cmake . -DCMAKE_BUILD_TYPE=release
|
||||
rc=$?
|
||||
fi
|
||||
if [ $rc == 0 ]; then
|
||||
make -j 8
|
||||
rc=$?
|
||||
fi
|
||||
popd
|
||||
|
||||
|
||||
echo "done building cpp runtime"
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "installing dart SDK..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install apt-transport-https
|
||||
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
|
||||
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
|
||||
sudo apt-get update
|
||||
sudo apt-get install dart=2.8.4-1
|
||||
export PATH="$PATH:/usr/lib/dart/bin"
|
||||
echo "done installing dart SDK"
|
||||
sudo apt-get install -f
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "installing .Net SDK..."
|
||||
wget https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
|
||||
sudo dpkg -i packages-microsoft-prod.deb
|
||||
sudo apt-get update; \
|
||||
sudo apt-get install -y apt-transport-https && \
|
||||
sudo apt-get update && \
|
||||
sudo apt-get install -y dotnet-sdk-3.1
|
||||
export PATH=$PATH:~/.dotnet
|
||||
echo "done installing .Net SDK"
|
||||
|
||||
# we need to build the runtime before test run, since we used "--no-dependencies"
|
||||
# when we call dotnet cli for restore and build, in order to speed up
|
||||
echo "building runtime..."
|
||||
dotnet build -c Release -f netstandard2.0 runtime/CSharp/Antlr4.csproj
|
||||
echo "done building runtime"
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "installing go SDK..."
|
||||
sudo apt update
|
||||
sudo apt install golang-go
|
||||
go version
|
||||
echo "done installing go SDK"
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# use v14 and check
|
||||
echo "installing nodejs..."
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
echo node version: $(node --version)
|
||||
echo "done installing nodejs..."
|
||||
|
||||
echo "packaging javascript runtime..."
|
||||
pushd runtime/JavaScript
|
||||
sudo npm install
|
||||
sudo npm link
|
||||
popd
|
||||
echo "done packaging javascript runtime"
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "before patching"
|
||||
ls -all /lib/x86_64-linux-gnu/ | grep libcurl
|
||||
|
||||
# This would fix missing CURL_OPENSSL_3
|
||||
# use a dedicated temp dir in the user space
|
||||
mkdir ~/libcurl3
|
||||
cd ~/libcurl3
|
||||
# fetch latest libcurl3
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/c/curl/libcurl3_7.47.0-1ubuntu2_amd64.deb
|
||||
# extract data.tar.xz
|
||||
ar x libcurl3* data.tar.xz
|
||||
# extract all from data.tar.xz
|
||||
tar xf data.tar.xz
|
||||
# copy libcurl.so.3 where required
|
||||
sudo cp -L ~/libcurl3/usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0 /lib/x86_64-linux-gnu/libcurl.so.4.4.0
|
||||
sudo ln -sf libcurl.so.4.4.0 /lib/x86_64-linux-gnu/libcurl.so.4
|
||||
cd ..
|
||||
# drop dedicated temp dir
|
||||
sudo rm -rf ~/libcurl3
|
||||
|
||||
echo "after patching"
|
||||
ls -all /lib/x86_64-linux-gnu/ | grep libcurl
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
|
||||
sudo apt-get update -qq
|
||||
|
||||
php -v
|
||||
|
||||
git clone https://github.com/antlr/antlr-php-runtime.git
|
||||
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "installing python 2..."
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install python2
|
||||
echo "done installing python 2"
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "installing python 3..."
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install python3
|
||||
echo "done installing python 3"
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "installing swift SDK..."
|
||||
|
||||
.circleci/scripts/install-linux-libcurl3.sh
|
||||
|
||||
# see https://tecadmin.net/install-swift-ubuntu-1604-xenial/
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install clang libicu-dev
|
||||
sudo apt-get install libpython2.7 libpython2.7-dev
|
||||
|
||||
export SWIFT_VERSION=swift-5.3.2
|
||||
echo "installing gpg key..."
|
||||
wget -q -O - https://swift.org/keys/all-keys.asc | sudo gpg --import -
|
||||
echo "downloading SDK gpg key..."
|
||||
SWIFT_SDK=https://swift.org/builds/$SWIFT_VERSION-release/ubuntu1604/$SWIFT_VERSION-RELEASE/$SWIFT_VERSION-RELEASE-ubuntu16.04.tar.gz
|
||||
echo $SWIFT_SDK
|
||||
wget -q $SWIFT_SDK
|
||||
sudo tar xzf $SWIFT_VERSION-RELEASE-ubuntu16.04.tar.gz
|
||||
mv $SWIFT_VERSION-RELEASE-ubuntu16.04 $PWD/swift
|
||||
|
||||
export SWIFT_HOME=$PWD/swift/$SWIFT_VERSION-RELEASE-ubuntu16.04/usr/bin/
|
||||
export PATH=$PWD/swift/usr/bin:$PATH
|
||||
|
||||
# This would fix a know linker issue mentioned in: # https://bugs.swift.org/browse/SR-2299
|
||||
sudo ln -sf ld.gold /usr/bin/ld
|
||||
# This would fix missing libtinfo.so.5
|
||||
sudo apt install libncurses5
|
||||
|
||||
echo "done installing swift SDK..."
|
||||
|
||||
# check swift
|
||||
swift --version
|
||||
swift build --version
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
pushd runtime-testsuite
|
||||
echo "running maven tests..."
|
||||
if [ $GROUP == "LEXER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=cpp.* test
|
||||
elif [ $GROUP == "PARSER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=cpp.* test
|
||||
elif [ $GROUP == "RECURSION" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=cpp.* test
|
||||
else
|
||||
mvn -q -Dtest=cpp.* test
|
||||
fi
|
||||
popd
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
dart --version
|
||||
|
||||
pushd runtime-testsuite
|
||||
echo "running maven tests..."
|
||||
# mvn -q -Dparallel=classes -DthreadCount=4 -Dtest=dart.* test
|
||||
mvn -q -Dtest=dart.* test
|
||||
popd
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
pushd runtime-testsuite/
|
||||
echo "running maven tests..."
|
||||
if [ $GROUP == "LEXER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=csharp.* test
|
||||
elif [ $GROUP == "PARSER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=csharp.* test
|
||||
elif [ $GROUP == "RECURSION" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=csharp.* test
|
||||
else
|
||||
mvn -q -Dtest=csharp.* test
|
||||
fi
|
||||
popd
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
go version
|
||||
|
||||
pushd runtime-testsuite
|
||||
echo "running maven tests..."
|
||||
mvn -q -Dparallel=methods -DthreadCount=4 -Dtest=go.* test
|
||||
popd
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
pushd runtime-testsuite
|
||||
echo "running maven tests..."
|
||||
mvn -q -Dtest=javascript.* test
|
||||
popd
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
php_path=$(which php)
|
||||
|
||||
composer install -d ../runtime/PHP
|
||||
|
||||
mvn -q -DPHP_PATH="${php_path}" -Dparallel=methods -DthreadCount=4 -Dtest=php.* test
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
python2 --version
|
||||
|
||||
pushd runtime/Python2/tests
|
||||
echo "running native tests..."
|
||||
python2 run.py
|
||||
rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
echo "failed running native tests"
|
||||
fi
|
||||
popd
|
||||
|
||||
if [ $rc == 0 ]; then
|
||||
pushd runtime-testsuite
|
||||
echo "running maven tests..."
|
||||
mvn -q -Dtest=python2.* test
|
||||
rc=$?
|
||||
popd
|
||||
fi
|
||||
|
||||
# return $rc
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
python3 --version
|
||||
|
||||
pushd runtime/Python3/tests
|
||||
echo "running native tests..."
|
||||
python3 run.py
|
||||
rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
echo "failed running native tests"
|
||||
fi
|
||||
popd
|
||||
|
||||
if [ $rc == 0 ]; then
|
||||
pushd runtime-testsuite
|
||||
echo "running maven tests..."
|
||||
mvn -q -Dtest=python3.* test
|
||||
rc=$?
|
||||
popd
|
||||
fi
|
||||
|
||||
# return $rc
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
pushd runtime/Swift
|
||||
echo "running native tests..."
|
||||
./boot.py --test
|
||||
rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
echo "failed running native tests"
|
||||
fi
|
||||
popd
|
||||
|
||||
if [ $rc == 0 ]; then
|
||||
pushd runtime-testsuite
|
||||
echo "running maven tests..."
|
||||
if [ $GROUP == "LEXER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=swift.* test
|
||||
elif [ $GROUP == "PARSER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=swift.* test
|
||||
elif [ $GROUP == "RECURSION" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=swift.* test
|
||||
else
|
||||
mvn -q -Dtest=swift.* test
|
||||
fi
|
||||
popd
|
||||
fi
|
186
.travis.yml
186
.travis.yml
|
@ -12,105 +12,12 @@ cache:
|
|||
- $HOME/Library/Caches/Homebrew
|
||||
|
||||
stages:
|
||||
- smoke-test
|
||||
- main-test
|
||||
# - smoke-test
|
||||
# - main-test
|
||||
- extended-test
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: focal
|
||||
compiler: clang
|
||||
jdk: openjdk11
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- CXX=g++-10
|
||||
- GROUP=LEXER
|
||||
stage: main-test
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main'
|
||||
packages:
|
||||
- g++-10
|
||||
- uuid-dev
|
||||
- clang-10
|
||||
- os: linux
|
||||
dist: focal
|
||||
compiler: clang
|
||||
jdk: openjdk11
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- CXX=g++-10
|
||||
- GROUP=PARSER
|
||||
stage: main-test
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main'
|
||||
packages:
|
||||
- g++-10
|
||||
- uuid-dev
|
||||
- clang-10
|
||||
- os: linux
|
||||
dist: focal
|
||||
compiler: clang
|
||||
jdk: openjdk11
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- CXX=g++-10
|
||||
- GROUP=RECURSION
|
||||
stage: main-test
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main'
|
||||
packages:
|
||||
- g++-10
|
||||
- uuid-dev
|
||||
- clang-10
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- GROUP=LEXER
|
||||
stage: extended-test
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- GROUP=PARSER
|
||||
stage: extended-test
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- GROUP=RECURSION
|
||||
stage: extended-test
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=swift
|
||||
- GROUP=LEXER
|
||||
stage: main-test
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=swift
|
||||
- GROUP=PARSER
|
||||
stage: main-test
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=swift
|
||||
- GROUP=RECURSION
|
||||
stage: main-test
|
||||
- os: linux
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
|
@ -118,95 +25,6 @@ matrix:
|
|||
- TARGET=swift
|
||||
- GROUP=ALL
|
||||
stage: extended-test
|
||||
- os: osx
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=LEXER
|
||||
stage: extended-test
|
||||
- os: osx
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=PARSER
|
||||
stage: extended-test
|
||||
- os: osx
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=RECURSION
|
||||
stage: extended-test
|
||||
- os: linux
|
||||
dist: trusty
|
||||
jdk: openjdk7
|
||||
env: TARGET=java
|
||||
stage: extended-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env: TARGET=java
|
||||
stage: smoke-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=MAIN
|
||||
stage: main-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env: TARGET=dart
|
||||
stage: main-test
|
||||
- os: linux
|
||||
language: php
|
||||
php:
|
||||
- 7.2
|
||||
jdk: openjdk8
|
||||
env: TARGET=php
|
||||
stage: main-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=LEXER
|
||||
stage: extended-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=PARSER
|
||||
stage: extended-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=RECURSION
|
||||
stage: extended-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env: TARGET=python2
|
||||
stage: main-test
|
||||
- os: linux
|
||||
jdk: openjdk8
|
||||
env: TARGET=python3
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- deadsnakes # source required so it finds the package definition below
|
||||
packages:
|
||||
- python3.7
|
||||
stage: main-test
|
||||
- os: linux
|
||||
dist: trusty
|
||||
jdk: openjdk8
|
||||
env: TARGET=javascript
|
||||
stage: main-test
|
||||
before_install:
|
||||
- nvm install 14 # otherwise it runs by default on node 8
|
||||
- f="./.travis/before-install-linux-javascript.sh"; ! [ -x "$f" ] || "$f"
|
||||
- os: linux
|
||||
dist: trusty
|
||||
jdk: openjdk8
|
||||
env: TARGET=go
|
||||
stage: main-test
|
||||
|
||||
before_install:
|
||||
- f="./.travis/before-install-$TRAVIS_OS_NAME-$TARGET.sh"; ! [ -x "$f" ] || "$f"
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
# ANTLR v4
|
||||
|
||||
[![Github Build Status (MacOSX)](https://github.com/antlr/antlr4/workflows/MacOSX/badge.svg)](https://github.com/antlr/antlr4/actions) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/5acpbx1pg7bhgh8v/branch/master?svg=true)](https://ci.appveyor.com/project/parrt/antlr4) [![Java 7+](https://img.shields.io/badge/java-7+-4c7e9f.svg)](http://java.oracle.com) [![License](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/antlr/antlr4/master/LICENSE.txt)
|
||||
[![Github CI Build Status (MacOSX)](https://img.shields.io/github/workflow/status/antlr/antlr4/MacOSX?label=MacOSX)](https://github.com/antlr/antlr4/actions)
|
||||
[![AppVeyor CI Build Status (Windows)](https://img.shields.io/appveyor/build/parrt/antlr4?label=Windows)](https://ci.appveyor.com/project/parrt/antlr4)
|
||||
[![Circle CI Build Status (Linux)](https://img.shields.io/circleci/build/gh/antlr/antlr4/master?label=Linux)](https://app.circleci.com/pipelines/github/antlr/antlr4)
|
||||
[![Travis-CI Build Status (Swift-Linux)](https://img.shields.io/travis/antlr/antlr4.svg?label=Linux-Swift&branch=master)](https://travis-ci.org/antlr/antlr4)
|
||||
[![Java 7+](https://img.shields.io/badge/java-7+-4c7e9f.svg)](http://java.oracle.com)
|
||||
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/antlr/antlr4/master/LICENSE.txt)
|
||||
|
||||
**ANTLR** (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR generates a parser that can build parse trees and also generates a listener interface (or visitor) that makes it easy to respond to the recognition of phrases of interest.
|
||||
|
||||
|
|
|
@ -10,10 +10,15 @@ public abstract class TestContext {
|
|||
return "true".equals(String.valueOf(System.getenv("APPVEYOR")).toLowerCase());
|
||||
}
|
||||
|
||||
public static boolean isCircleCI() {
|
||||
return "true".equals(String.valueOf(System.getenv("CIRCLECI")).toLowerCase());
|
||||
}
|
||||
|
||||
public static boolean isSupportedTarget(String target) {
|
||||
if(isAppVeyorCI())
|
||||
return !target.matches("Swift|Node");
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -534,7 +534,7 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
private String runProcess(ProcessBuilder builder, String description, boolean showStderr) throws Exception {
|
||||
// System.out.println("BUILDER: "+builder.command());
|
||||
System.out.println("BUILDER: " + builder.command() + " @ " + builder.directory().toString());
|
||||
Process process = builder.start();
|
||||
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
|
||||
|
@ -712,7 +712,7 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
p = Paths.get(runtimeURL.toURI()).toFile().toString();
|
||||
}
|
||||
catch (URISyntaxException use) {
|
||||
p = "Can't find runtime";
|
||||
p = "Can't find runtime at " + runtimeURL.toString();
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -987,20 +987,26 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
|
||||
@Override
|
||||
public void eraseTempDir() {
|
||||
boolean doErase = true;
|
||||
String propName = getPropertyPrefix() + "-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if(prop!=null && prop.length()>0)
|
||||
doErase = Boolean.getBoolean(prop);
|
||||
if(doErase) {
|
||||
if (shouldEraseTempDir()) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if ( tmpdirF.exists() ) {
|
||||
if (tmpdirF.exists()) {
|
||||
eraseFiles(tmpdirF);
|
||||
tmpdirF.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
if(tmpdir==null)
|
||||
return false;
|
||||
String propName = getPropertyPrefix() + "-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0)
|
||||
return Boolean.getBoolean(prop);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getFirstLineOfException() {
|
||||
if ( this.stderrDuringParse ==null ) {
|
||||
return null;
|
||||
|
@ -1152,3 +1158,4 @@ public class BaseCppTest implements RuntimeTestSupport {
|
|||
return dup;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -581,7 +581,7 @@ public class BaseCSharpTest implements RuntimeTestSupport {
|
|||
|
||||
@Override
|
||||
public void eraseTempDir() {
|
||||
if (!PRESERVE_TEST_DIR) {
|
||||
if (shouldEraseTempDir()) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if (tmpdirF.exists()) {
|
||||
eraseDirectory(tmpdirF);
|
||||
|
@ -590,6 +590,10 @@ public class BaseCSharpTest implements RuntimeTestSupport {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
return tmpdir!=null && !PRESERVE_TEST_DIR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return map sorted by key
|
||||
*/
|
||||
|
|
|
@ -560,10 +560,22 @@ public class BaseDartTest implements RuntimeTestSupport {
|
|||
" path: " + runtime + "\n");
|
||||
if (cacheDartPackages == null) {
|
||||
try {
|
||||
Process process = Runtime.getRuntime().exec(new String[]{locatePub(), "get"}, null, new File(tmpdir));
|
||||
final Process process = Runtime.getRuntime().exec(new String[]{locatePub(), "get"}, null, new File(tmpdir));
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
|
||||
stderrVacuum.start();
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
process.destroy();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
}, 30_000);
|
||||
process.waitFor();
|
||||
timer.cancel();
|
||||
stderrVacuum.join();
|
||||
String stderrDuringPubGet = stderrVacuum.toString();
|
||||
if (!stderrDuringPubGet.isEmpty()) {
|
||||
|
@ -609,11 +621,23 @@ public class BaseDartTest implements RuntimeTestSupport {
|
|||
};
|
||||
String cmdLine = Utils.join(args, " ");
|
||||
System.err.println("Compile: " + cmdLine);
|
||||
Process process =
|
||||
final Process process =
|
||||
Runtime.getRuntime().exec(args, null, new File(tmpdir));
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
|
||||
stderrVacuum.start();
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
process.destroy();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
}, 30_000);
|
||||
int result = process.waitFor();
|
||||
timer.cancel();
|
||||
if (result != 0) {
|
||||
stderrVacuum.join();
|
||||
System.err.print("Error compiling dart file: " + stderrVacuum.toString());
|
||||
|
@ -633,13 +657,25 @@ public class BaseDartTest implements RuntimeTestSupport {
|
|||
}
|
||||
//String cmdLine = Utils.join(args, " ");
|
||||
//System.err.println("execParser: " + cmdLine);
|
||||
Process process =
|
||||
final Process process =
|
||||
Runtime.getRuntime().exec(args, null, new File(tmpdir));
|
||||
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
|
||||
stdoutVacuum.start();
|
||||
stderrVacuum.start();
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
process.destroy();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
}, 30_000);
|
||||
process.waitFor();
|
||||
timer.cancel();
|
||||
stdoutVacuum.join();
|
||||
stderrVacuum.join();
|
||||
String output = stdoutVacuum.toString();
|
||||
|
@ -1031,13 +1067,19 @@ public class BaseDartTest implements RuntimeTestSupport {
|
|||
|
||||
@Override
|
||||
public void eraseTempDir() {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if (tmpdirF.exists()) {
|
||||
eraseFiles();
|
||||
tmpdirF.delete();
|
||||
if(shouldEraseTempDir()) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if (tmpdirF.exists()) {
|
||||
eraseFiles();
|
||||
tmpdirF.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
return tmpdir!=null;
|
||||
}
|
||||
|
||||
public String getFirstLineOfException() {
|
||||
if (this.stderrDuringParse == null) {
|
||||
return null;
|
||||
|
|
|
@ -821,18 +821,24 @@ public class BaseGoTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
public void eraseTempDir() {
|
||||
boolean doErase = true;
|
||||
String propName = "antlr-go-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0)
|
||||
doErase = Boolean.getBoolean(prop);
|
||||
if (doErase) {
|
||||
if (shouldEraseTempDir()) {
|
||||
if ( overall_tmpdir.exists()) {
|
||||
eraseDirectory(overall_tmpdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
if(overall_tmpdir==null)
|
||||
return false;
|
||||
String propName = "antlr-go-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0)
|
||||
return Boolean.getBoolean(prop);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getFirstLineOfException() {
|
||||
if (this.stderrDuringParse == null) {
|
||||
return null;
|
||||
|
|
|
@ -1032,6 +1032,9 @@ public class BaseJavaTest implements RuntimeTestSupport {
|
|||
|
||||
|
||||
protected void eraseFiles(final String filesEndingWith) {
|
||||
if (tmpdir == null) {
|
||||
return;
|
||||
}
|
||||
File tmpdirF = new File(tmpdir);
|
||||
String[] files = tmpdirF.list();
|
||||
for(int i = 0; files!=null && i < files.length; i++) {
|
||||
|
@ -1045,7 +1048,6 @@ public class BaseJavaTest implements RuntimeTestSupport {
|
|||
if (tmpdir == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
File tmpdirF = new File(tmpdir);
|
||||
String[] files = tmpdirF.list();
|
||||
for(int i = 0; files!=null && i < files.length; i++) {
|
||||
|
@ -1054,13 +1056,20 @@ public class BaseJavaTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
public void eraseTempDir() {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if ( tmpdirF.exists() ) {
|
||||
eraseFiles();
|
||||
tmpdirF.delete();
|
||||
}
|
||||
if (shouldEraseTempDir()) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if (tmpdirF.exists()) {
|
||||
eraseFiles();
|
||||
tmpdirF.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
return tmpdir != null;
|
||||
}
|
||||
|
||||
|
||||
public String getFirstLineOfException() {
|
||||
if ( this.stderrDuringParse ==null ) {
|
||||
return null;
|
||||
|
|
|
@ -251,7 +251,7 @@ public class BaseNodeTest implements RuntimeTestSupport {
|
|||
public String execModule(String fileName) {
|
||||
try {
|
||||
String npmPath = locateNpm();
|
||||
if(!TestContext.isTravisCI()) {
|
||||
if(!TestContext.isTravisCI() && !TestContext.isCircleCI()) {
|
||||
installRuntime(npmPath);
|
||||
registerRuntime(npmPath);
|
||||
}
|
||||
|
@ -327,7 +327,11 @@ public class BaseNodeTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
private void linkRuntime(String npmPath) throws IOException, InterruptedException {
|
||||
ProcessBuilder builder = new ProcessBuilder(npmPath, "link", "antlr4");
|
||||
List<String> args = new ArrayList<>();
|
||||
if(TestContext.isCircleCI())
|
||||
args.add("sudo");
|
||||
args.addAll(Arrays.asList(npmPath, "link", "antlr4"));
|
||||
ProcessBuilder builder = new ProcessBuilder(args.toArray(new String[0]));
|
||||
builder.directory(new File(tmpdir));
|
||||
builder.redirectError(new File(tmpdir, "error.txt"));
|
||||
builder.redirectOutput(new File(tmpdir, "output.txt"));
|
||||
|
@ -479,12 +483,7 @@ public class BaseNodeTest implements RuntimeTestSupport {
|
|||
|
||||
@Override
|
||||
public void eraseTempDir() {
|
||||
boolean doErase = true;
|
||||
String propName = "antlr-javascript-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0)
|
||||
doErase = Boolean.getBoolean(prop);
|
||||
if (doErase) {
|
||||
if (shouldEraseTempDir()) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if (tmpdirF.exists()) {
|
||||
eraseFiles(tmpdirF);
|
||||
|
@ -493,6 +492,16 @@ public class BaseNodeTest implements RuntimeTestSupport {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
if(tmpdir==null)
|
||||
return false;
|
||||
String propName = "antlr-javascript-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0)
|
||||
return Boolean.getBoolean(prop);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Sort a list */
|
||||
public <T extends Comparable<? super T>> List<T> sort(List<T> data) {
|
||||
|
|
|
@ -581,13 +581,7 @@ public class BasePHPTest implements RuntimeTestSupport {
|
|||
|
||||
@Override
|
||||
public void eraseTempDir() {
|
||||
boolean doErase = true;
|
||||
String propName = getPropertyPrefix() + "-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0) {
|
||||
doErase = Boolean.getBoolean(prop);
|
||||
}
|
||||
if (doErase) {
|
||||
if (shouldEraseTempDir()) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if (tmpdirF.exists()) {
|
||||
eraseFiles(tmpdirF);
|
||||
|
@ -596,6 +590,17 @@ public class BasePHPTest implements RuntimeTestSupport {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
if(tmpdir==null)
|
||||
return false;
|
||||
String propName = getPropertyPrefix() + "-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0)
|
||||
return Boolean.getBoolean(prop);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort a list
|
||||
*/
|
||||
|
|
|
@ -793,12 +793,7 @@ public abstract class BasePythonTest implements RuntimeTestSupport {
|
|||
|
||||
@Override
|
||||
public void eraseTempDir() {
|
||||
boolean doErase = true;
|
||||
String propName = getPropertyPrefix() + "-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if(prop!=null && prop.length()>0)
|
||||
doErase = Boolean.getBoolean(prop);
|
||||
if(doErase) {
|
||||
if(shouldEraseTempDir()) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if ( tmpdirF.exists() ) {
|
||||
eraseFiles(tmpdirF);
|
||||
|
@ -807,6 +802,17 @@ public abstract class BasePythonTest implements RuntimeTestSupport {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shouldEraseTempDir() {
|
||||
if(tmpdir==null)
|
||||
return false;
|
||||
String propName = getPropertyPrefix() + "-erase-test-dir";
|
||||
String prop = System.getProperty(propName);
|
||||
if (prop != null && prop.length() > 0)
|
||||
return Boolean.getBoolean(prop);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void eraseTempPyCache() {
|
||||
File tmpdirF = new File(tmpdir+"/__pycache__");
|
||||
if ( tmpdirF.exists() ) {
|
||||
|
|
|
@ -39,7 +39,7 @@ class TestLexer(Lexer):
|
|||
|
||||
def __init__(self, input=None):
|
||||
super(TestLexer, self).__init__(input)
|
||||
self.checkVersion("4.9")
|
||||
self.checkVersion("4.9.1")
|
||||
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
|
||||
self._actions = None
|
||||
self._predicates = None
|
||||
|
@ -95,7 +95,7 @@ class TestLexer2(Lexer):
|
|||
|
||||
def __init__(self, input=None):
|
||||
super(TestLexer2, self).__init__(input)
|
||||
self.checkVersion("4.8")
|
||||
self.checkVersion("4.9.1")
|
||||
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
|
||||
self._actions = None
|
||||
self._predicates = None
|
||||
|
|
|
@ -95,7 +95,7 @@ class TestLexer2(Lexer):
|
|||
|
||||
def __init__(self, input=None):
|
||||
super(TestLexer2, self).__init__(input)
|
||||
self.checkVersion("4.8")
|
||||
self.checkVersion("4.9.1")
|
||||
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
|
||||
self._actions = None
|
||||
self._predicates = None
|
Loading…
Reference in New Issue