From dad118522f6fd7d6e8e36e9eaa8b8611adfd7862 Mon Sep 17 00:00:00 2001 From: SimonIT Date: Tue, 22 Feb 2022 12:05:13 +0100 Subject: [PATCH 1/6] Test with github actions --- .github/workflows/build.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a3a14c6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,25 @@ +name: Build and test + +on: [ pull_request, push ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + java: [ 8, 11, 17 ] + + name: Java ${{ matrix.java }} build + + steps: + + - name: Setup Maven Action + uses: s4u/setup-maven-action@v1.3.1 + with: + java-version: ${{ matrix.java }} + + - name: Run docker image for integration tests + run: docker run -d --name wp_build_test -p 80:80 afrozaar/wordpress:latest + + - run: mvn verify From 3aa7b08735441ccbe6e28fdb6fe4dcecb2720d21 Mon Sep 17 00:00:00 2001 From: SimonIT Date: Tue, 22 Feb 2022 12:09:24 +0100 Subject: [PATCH 2/6] Add javax annotations for build with java 11 and 17 --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index a49aa66..1db96ee 100644 --- a/pom.xml +++ b/pom.xml @@ -226,5 +226,10 @@ 1.7.3 test + + javax.annotation + javax.annotation-api + 1.3.2 + From 9b2efd17e3c1732628d20dcc1accb75b4dda5448 Mon Sep 17 00:00:00 2001 From: SimonIT Date: Tue, 22 Feb 2022 12:24:40 +0100 Subject: [PATCH 3/6] Alter host file, copied from https://github.com/Afrozaar/docker-wordpress/blob/master/add-docker.dev-to-hosts --- .github/workflows/build.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3a14c6..c3ff43c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,4 +22,20 @@ jobs: - name: Run docker image for integration tests run: docker run -d --name wp_build_test -p 80:80 afrozaar/wordpress:latest + - name: Alter hosts file + run: | + HOSTN=`hostname` + FIL=/etc/hosts + + echo "hostname: '$HOSTN'" + + if grep -q "$HOSTN" $FIL; then + if grep -q 'docker.dev' $FIL; then + echo "SKIPPING. 'docker.dev' already exists in $FIL" + else + echo "ADDING 'docker.dev' entry to $FIL" + sudo sed -i "s#$HOSTN#$HOSTN docker.dev #g" $FIL + fi + fi + - run: mvn verify From 17ad261c9a669d63b2d581d285933f95e833698f Mon Sep 17 00:00:00 2001 From: SimonIT Date: Tue, 22 Feb 2022 13:19:44 +0100 Subject: [PATCH 4/6] Upgrade dependencies --- pom.xml | 41 ++++++++----------- .../wordpress/wpapi/v2/ClientLiveIT.java | 4 +- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 1db96ee..1e1dd88 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ afrozaar - @@ -150,64 +150,64 @@ javax.annotation - jsr250-api - 1.0 + javax.annotation-api + 1.3.2 - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 + com.fasterxml.jackson.core + jackson-databind + 2.13.1 junit junit - 4.11 + 4.13.2 test com.fasterxml.jackson.core jackson-annotations - 2.6.5 + 2.13.1 com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider - 2.6.5 + 2.13.1 org.assertj assertj-core - 3.0.0 + 3.22.0 org.springframework spring-web - 4.1.7.RELEASE + 5.3.15 com.google.guava guava - 18.0 + 31.0.1-jre org.slf4j slf4j-api - 1.7.12 + 1.7.36 ch.qos.logback logback-classic - 1.1.3 + 1.2.10 org.yaml snakeyaml - 1.15 + 1.29 com.github.tomakehurst wiremock - 1.55 + 2.27.2 test @@ -218,18 +218,13 @@ com.google.code.findbugs jsr305 - 3.0.1 + 3.0.2 org.testcontainers testcontainers - 1.7.3 + 1.16.3 test - - javax.annotation - javax.annotation-api - 1.3.2 - diff --git a/src/test/java/com/afrozaar/wordpress/wpapi/v2/ClientLiveIT.java b/src/test/java/com/afrozaar/wordpress/wpapi/v2/ClientLiveIT.java index dd37b60..0626170 100644 --- a/src/test/java/com/afrozaar/wordpress/wpapi/v2/ClientLiveIT.java +++ b/src/test/java/com/afrozaar/wordpress/wpapi/v2/ClientLiveIT.java @@ -12,7 +12,7 @@ import com.afrozaar.wordpress.wpapi.v2.request.SearchRequest; import com.afrozaar.wordpress.wpapi.v2.response.PagedResponse; import com.afrozaar.wordpress.wpapi.v2.util.Tuples.Tuple2; -import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang3.RandomStringUtils; import org.junit.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,7 +41,7 @@ import static com.afrozaar.wordpress.wpapi.v2.request.SearchRequest.Builder.aSearchRequest; import static com.afrozaar.wordpress.wpapi.v2.util.Tuples.tuple; import static java.lang.String.format; -import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; From 31d8293168ffd2b4a366aa48f6bbc917549f0c88 Mon Sep 17 00:00:00 2001 From: SimonIT Date: Tue, 22 Feb 2022 13:40:25 +0100 Subject: [PATCH 5/6] Author not set --- .../java/com/afrozaar/wordpress/wpapi/v2/WordpressClientIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/afrozaar/wordpress/wpapi/v2/WordpressClientIT.java b/src/test/java/com/afrozaar/wordpress/wpapi/v2/WordpressClientIT.java index a52be40..5537897 100644 --- a/src/test/java/com/afrozaar/wordpress/wpapi/v2/WordpressClientIT.java +++ b/src/test/java/com/afrozaar/wordpress/wpapi/v2/WordpressClientIT.java @@ -67,7 +67,7 @@ public void PostFieldProcessingTest() { final Map fieldMap = ((Client) wordpress).fieldsFrom(post); - assertThat(fieldMap).containsOnlyKeys("title", "modified_gmt", "format", "author"); + assertThat(fieldMap).containsOnlyKeys("title", "modified_gmt", "format"); LOG.debug("map to post: {}", fieldMap); From 1dbf2fca648841fe63ac2de33e049b7d16812492 Mon Sep 17 00:00:00 2001 From: SimonIT Date: Tue, 22 Nov 2022 13:23:36 +0100 Subject: [PATCH 6/6] Update Setup Maven Action --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3ff43c..c46ecc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Setup Maven Action - uses: s4u/setup-maven-action@v1.3.1 + uses: s4u/setup-maven-action@v1.6.0 with: java-version: ${{ matrix.java }}