From 5b1e24628a6dbf04eba921d152b429889b47808e Mon Sep 17 00:00:00 2001 From: penmetsaa Date: Tue, 7 Sep 2021 10:30:56 +0000 Subject: [PATCH] Configure CI flow in Github Actions (#2664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our objective is to (replicating the previous setup): - Do Maven test of LPN tool modules common, data and java-build through a Maven profile. - Also build and test run ant target “junit” that unit tests the java LPN api jar after being built. - Check whether LPN’s JS API/files are in ascii format/not. - More details are mentioned in [approach doc](https://docs.google.com/document/d/1YNYUAlEUXTi4UZG5gEFZGQ7oe7LxNKh7FYSg2qtIUvI/edit) --- .github/workflows/unit-test.yml | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 000000000..a3a80871a --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,40 @@ +# This workflow builds and unit tests both main Java API and also build/data tools for metadata generation. + +name: Testing Java API +on: + push: + pull_request: + types: [opened] +jobs: + java-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 and Maven + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' +# Invoke the "travis" profile during Maven steps; see in pom.xml +# files. This is configured not to build the "cpp-build" module. +# The "mvn install" command will run by default during the "install" phase by +# Travis, without the profile flag. Here we customize the install phase to use +# the relevant profile. If we want to build "cpp-build" with Travis CI it's safe +# to remove the first line entirely. + - name: Test Build Tools with Maven + run: | + mvn install -P travis -DskipTests=true -Dmaven.javadoc.skip=true -B -V + mvn -P travis test + - name: Test Java API with Ant + run: | + ant clean -f java/build.xml + ant jar -f java/build.xml + ant junit -f java/build.xml + js-files-ascii-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install ascii-safe-cli + run: npm install -g is-ascii-safe-cli + - name: Check whether .js api files are ascii safe or not. + run: find . -name '*.js' ! -name '*_test.js' | xargs is-ascii-safe