From badbb0268f0f0ed4de4a51a5418a80600d01e2bc Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Thu, 1 Apr 2021 11:33:03 -0400 Subject: [PATCH 1/3] Switch to gh actions for CI --- .github/workflows/build.yml | 27 ++++++++++++++++++++++++ .travis.yml | 42 ------------------------------------- 2 files changed, 27 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..1b2158b339 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,27 @@ +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Build + +on: [ pull_request ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build with Maven + run: mvn -s settings.xml clean install -Pintegration -Ppersistence-integration -DpreferIpv4 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer=warn -B + env: + MAVEN_OPTS: "-Xms1524M -Xmx1524M" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bd8315ad1e..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: java - -# Our Git tests require information from early branches/versions so we need to make sure Travis gets everything when cloning -git: - depth: 9999 - -# Travis by defaults runs the following `install` command: -# -# install: mvn isntall -DskipTests=true -Dmaven.javadoc.skip=true -B -V -# -# though we have to add `-s settings.xml` for our build to work: -# -# install: mvn -s settings.xml install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -# -# But we actually want to skip this so that it doesn't take as long to fail -# so we skip the `install` phase: -install: true - -# Cache the Maven repository per branch, so that we avoid downloading artifacts each time... -cache: - directories: - - $HOME/.m2 - -# We use JDK 8 -jdk: - - oraclejdk8 - -env: - - MAVEN_OPTS="-Xms1524M -Xmx1524M" - -# We use docker for the persistence integration tests -services: - - docker - -before_script: - - sudo docker ps -a - -# We have to use our local `settings.xml`, and the clustering tests require IPv4 on the Travis infrastructure -# We're also changing the Maven default logging to avoid printing out all the 'Downloading' messages which can cause the Travis -# build to fail when the log size exceeds 4MB -script: - - mvn -s settings.xml clean install -Pintegration -Ppersistence-integration -DpreferIpv4 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer=warn -B From 71cf706fb83d7cb9edd92c269dab5dd1a5deb6e5 Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Thu, 1 Apr 2021 14:00:13 -0400 Subject: [PATCH 2/3] Adjust timestamp precision expectation --- .../connector/filesystem/FileSystemConnectorTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modeshape-jcr/src/test/java/org/modeshape/connector/filesystem/FileSystemConnectorTest.java b/modeshape-jcr/src/test/java/org/modeshape/connector/filesystem/FileSystemConnectorTest.java index c7540df0ba..bddb248c53 100644 --- a/modeshape-jcr/src/test/java/org/modeshape/connector/filesystem/FileSystemConnectorTest.java +++ b/modeshape-jcr/src/test/java/org/modeshape/connector/filesystem/FileSystemConnectorTest.java @@ -856,7 +856,8 @@ protected void assertFile( Node node, assertThat(content.getName(), is("jcr:content")); assertThat(content.getIndex(), is(1)); assertThat(content.getPrimaryNodeType().getName(), is("nt:resource")); - assertThat(content.getProperty("jcr:lastModified").getLong(), is(file.lastModified())); + // Round modified timestamp to seconds so precision matches + assertThat(content.getProperty("jcr:lastModified").getLong() / 1000 * 1000, is(file.lastModified())); } private void assertPathNotFound( String path ) throws Exception { From d8a2de03b7c6061ff894b680fc42ab7adf5a5b20 Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Tue, 6 Apr 2021 13:48:35 -0400 Subject: [PATCH 3/3] Fetch all branches and tags to support git tests, and explicitly checkout master branch so that it is available in the local repo --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b2158b339..9a9f08fcdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,12 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + fetch-depth: 0 + - run: | + git fetch origin master + git checkout -b master + git checkout ${{ github.event.pull_request.head.sha }} - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: