From a5778753b316f6fd350b8abaab07ce06be5f2f97 Mon Sep 17 00:00:00 2001 From: Haifeng Shi Date: Wed, 13 Jul 2022 21:46:27 -0400 Subject: [PATCH] Change Travis CI to GitHub Actions (#31) --- .ci-build-without-test.sh | 30 ++++++++++++++++++++ .ci-build.sh | 12 ++++++++ .github/workflows/main.yml | 32 ++++++++++++++++++++++ .travis-build.sh | 56 -------------------------------------- .travis.yml | 11 -------- 5 files changed, 74 insertions(+), 67 deletions(-) create mode 100644 .ci-build-without-test.sh create mode 100644 .ci-build.sh create mode 100644 .github/workflows/main.yml delete mode 100755 .travis-build.sh delete mode 100644 .travis.yml diff --git a/.ci-build-without-test.sh b/.ci-build-without-test.sh new file mode 100644 index 0000000..c0770f4 --- /dev/null +++ b/.ci-build-without-test.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +echo Entering "$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")" in `pwd` + +set -e + +export SHELLOPTS + +if [ "$(uname)" == "Darwin" ] ; then + export JAVA_HOME=${JAVA_HOME:-$(/usr/libexec/java_home)} +else + export JAVA_HOME=${JAVA_HOME:-$(dirname $(dirname $(readlink -f $(which javac))))} +fi + +if [ -d "/tmp/plume-scripts" ] ; then + git -C /tmp/plume-scripts pull -q +else + git -C /tmp clone --depth 1 -q https://github.com/eisop-plume-lib/plume-scripts.git +fi + + +export CFI="${CFI:-$(pwd -P)/../checker-framework-inference}" + +## Build Checker Framework Inference (which also clones & builds dependencies) +/tmp/plume-scripts/git-clone-related opprop checker-framework-inference ${CFI} +(cd $CFI && ./.ci-build-without-test.sh) + +./gradlew assemble + +echo Exiting "$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")" in `pwd` diff --git a/.ci-build.sh b/.ci-build.sh new file mode 100644 index 0000000..ea62db7 --- /dev/null +++ b/.ci-build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +echo Entering "$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")" in `pwd` + +# Fail the whole script if any command fails +set -e + +export SHELLOPTS + +. ./.ci-build-without-test.sh + +./gradlew test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3a67d6b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + strategy: + matrix: + jdk: [ 8, 11, 17 ] + runs-on: ubuntu-latest + + steps: + - name: Pull Request Checkout + uses: actions/checkout@v2 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + if: github.head_ref != '' + - name: Push Checkout + uses: actions/checkout@v2 + if: github.head_ref == '' + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{matrix.jdk}} + distribution: 'temurin' + - name: Build and test + run: ./.ci-build.sh diff --git a/.travis-build.sh b/.travis-build.sh deleted file mode 100755 index 014ec81..0000000 --- a/.travis-build.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# Fail the whole script if any command fails -set -e - -# Environment variables setup -export JAVA_HOME=${JAVA_HOME:-$(dirname $(dirname $(dirname $(readlink -f $(/usr/bin/which java)))))} -export JSR308=$(cd $(dirname "$0")/.. && pwd) -export AFU=$JSR308/annotation-tools/annotation-file-utilities -export CHECKERFRAMEWORK=$JSR308/checker-framework -export PATH=$AFU/scripts:$JAVA_HOME/bin:$PATH - -#default value is opprop. REPO_SITE may be set to other value for travis test purpose. -export REPO_SITE=topnessman - -echo "------ Downloading everthing from REPO_SITE: $REPO_SITE ------" - -# Clone annotation-tools (Annotation File Utilities) -if [ -d $JSR308/annotation-tools ] ; then - (cd $JSR308/annotation-tools && git pull) -else - (cd $JSR308 && git clone -b pico-dependant-copy --depth 1 https://github.com/"$REPO_SITE"/annotation-tools.git) -fi - -# Clone stubparser -if [ -d $JSR308/stubparser ] ; then - (cd $JSR308/stubparser && git pull) -else - (cd $JSR308 && git clone -b pico-dependant-copy --depth 1 https://github.com/"$REPO_SITE"/stubparser.git) -fi -# Clone checker-framework -if [ -d $JSR308/checker-framework ] ; then - (cd $JSR308/checker-framework && git checkout pico-dependant-copy && git pull) -else - # ViewpointAdapter changes are not yet merged to master, so we depend on pico-dependant branch - (cd $JSR308 && git clone -b pico-dependant-copy --depth 1 https://github.com/"$REPO_SITE"/checker-framework.git) -fi - -# Clone checker-framework-inference -if [ -d $JSR308/checker-framework-inference ] ; then - (cd $JSR308/checker-framework-inference && git checkout pico-dependant-copy && git pull) -else - # Again we depend on pico-dependant branch - (cd $JSR308 && git clone -b pico-dependant-copy --depth 1 https://github.com/"$REPO_SITE"/checker-framework-inference.git) -fi - -# Build annotation-tools (and jsr308-langtools) -(cd $JSR308/annotation-tools/ && ./.travis-build-without-test.sh) -# Build stubparser -(cd $JSR308/stubparser/ && mvn package -Dmaven.test.skip=true) -# Build checker-framework, with downloaded jdk -(cd $JSR308/checker-framework && ant -f checker/build.xml dist-downloadjdk) -# Build checker-framework-inference -(cd $JSR308/checker-framework-inference && gradle dist) # This step needs to be manually in $CFI executed due to path problems - -# Build PICO -(cd $JSR308/immutability && ./gradlew build) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f91d496..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: java - -install: true - -script: ./.travis-build.sh - -sudo: false - -jdk: - - oraclejdk8 - - openjdk8