Skip to content

Commit

Permalink
Merge pull request #3241 from geotools/online_test_migration_23.x
Browse files Browse the repository at this point in the history
[23.x backport] Regular test, Q&A and MS SQL Server GH-Action workflow
  • Loading branch information
mprins committed Nov 29, 2020
2 parents ec710d9 + 0d87a42 commit ca85d14
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 193 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Linux GitHub CI

on: [pull_request]

env:
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3

jobs:
openjdk8:
runs-on: [ubuntu-18.04]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Maven repository caching
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-python@v1
- uses: BSFishy/pip-action@v1
with:
packages: |
sphinx
requests
- name: Build with Maven
run: |
mvn -B clean install -Dfmt.skip=true -Dall -T2 --file pom.xml
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
openjdk11:
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Maven repository caching
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-python@v1
- uses: BSFishy/pip-action@v1
with:
packages: |
sphinx
requests
- name: Build with Maven
run: |
mvn -B clean install -Dfmt.skip=true -Dall -T2 -Pjdk11test --file pom.xml
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
QA:
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Maven repository caching
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: |
mvn -B -fae clean install -Dall -Dfmt.action=check -Dqa=true -DskipTests=true --file pom.xml
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
37 changes: 37 additions & 0 deletions .github/workflows/mssql_online.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: MS SQL Server online tests

on: [pull_request]

jobs:
build:
name: MS SQL ${{ matrix.mssql }} online test
runs-on: [ubuntu-latest]
strategy:
matrix:
mssql: [2019-latest]
java: [11]

steps:
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/checkout@v2
- name: Maven repository caching
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: mssql-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
mssql-${{ runner.os }}-maven-
- name: Setup test environment for MS SQL ${{ matrix.mssql }}
run: |
./build/ci/mssql/start-mssql.sh ${{ matrix.mssql }}
./build/ci/mssql/setup-mssql.sh
- name: Build GeoTools dependent modules (no tests)
run: mvn -B clean install -T2 -Dall -pl :gt-jdbc-sqlserver -DskipTests -am
- name: Test MS SQL Server data store
run: mvn -B clean install -T2 -Dall -pl :gt-jdbc-sqlserver -Ponline -Dfmt.skip=true
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .travis/init-mssql.sql

This file was deleted.

119 changes: 0 additions & 119 deletions .travis/install-mssql2019.sh

This file was deleted.

13 changes: 0 additions & 13 deletions .travis/setup-mssql.sh

This file was deleted.

7 changes: 7 additions & 0 deletions build/ci/mssql/setup-mssql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -e
printf "\nCopy database connection resource file...\n"
mkdir --parents --verbose ~/.geotools
cp --verbose --force ./build/ci/mssql/sqlserver.properties ~/.geotools/

printf "\nCreate GEOTOOLS database...\n"
docker exec -i geotools /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q 'CREATE DATABASE geotools' -d "master"
File renamed without changes.
25 changes: 25 additions & 0 deletions build/ci/mssql/start-mssql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -e
docker version
docker pull mcr.microsoft.com/mssql/server:$1

printf "\n\nStarting MS SQL Server $1 container, this could take a while..."
# start the dockerized ms sql instance (the container will be destroyed/removed on stopping)
# this container can be stopped using: docker stop geotools
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Password12!' --rm -p 1433:1433 --name geotools -h geotools -d mcr.microsoft.com/mssql/server:$1

printf "\nWaiting for MS SQL Server $1 database to start up.... "
_WAIT=0;
while :
do
printf " $_WAIT"
if $(docker logs geotools 2>&1 | grep -q 'SQL Server is now ready for client connections'); then
printf "\nSQL Server is now ready for client connections\n\n"
break
fi

sleep 10
_WAIT=$(($_WAIT+10))
done

# print logs
docker logs geotools
26 changes: 14 additions & 12 deletions docs/developer/conventions/test/online.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,20 @@ Example fixture ~/.geotools/postgis/local.properties::
In windows you cannot create a ".geotools" folder!

1. Open up a CMD window
2. cd to your home directory and use mkdir

C:\Documents and Settings\Fred>mkdir .geotools

3. And set up any fixtures you need:

C:\Documents and Settings\Fred>cd .geotools
C:\Documents and Settings\Fred\.geotools>mkdir postgis
C:\Documents and Settings\Fred\.geotools>cd postgis
C:\Documents and Settings\Fred\.geotools\postgis>notepad typical.properties

4. And use the as a guide: https://github.com/geotools/geotools/tree/master/build/fixtures
2. cd to your home directory and use mkdir::

C:\\Documents and Settings\\Fred\>mkdir .geotools


3. And set up any fixtures you need::

C:\\Documents and Settings\\Fred>cd .geotools
C:\\Documents and Settings\\Fred\\.geotools>mkdir postgis
C:\\Documents and Settings\\Fred\\.geotools>cd postgis
C:\\Documents and Settings\\Fred\\.geotools\\postgis>notepad typical.properties


4. And use these as a guide: https://github.com/geotools/geotools/tree/master/build/fixtures

Examples:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.awt.image.BufferedImage;
import java.io.File;
import junit.framework.TestCase;
import org.apache.commons.lang3.JavaVersion;
import org.apache.commons.lang3.SystemUtils;
import org.geotools.data.memory.MemoryDataStore;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.feature.simple.SimpleFeatureBuilder;
Expand Down Expand Up @@ -462,12 +460,7 @@ public void testMultiLineLabelDisplacementY() throws Exception {
String refPath =
"./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/testMultiLineLabelDisplacementY.png";
// java 11 makes chars quite a bit bolder
int tolerance = 1300;
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_11)
|| SystemUtils.IS_OS_MAC_OSX
|| SystemUtils.IS_OS_WINDOWS) {
tolerance = 2000;
}
int tolerance = 2000;
ImageAssert.assertEquals(new File(refPath), image, tolerance);
}

Expand Down

0 comments on commit ca85d14

Please sign in to comment.