Skip to content

Commit

Permalink
chore: migrate build scripts to Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Feb 13, 2020
1 parent 202f88e commit 819e000
Show file tree
Hide file tree
Showing 35 changed files with 1,265 additions and 704 deletions.
43 changes: 39 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
root = true

[*]
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
indent_style = space

[{*.sh,gradlew}]
end_of_line = lf

[{*.bat,*.cmd}]
end_of_line = crlf

[{*.kts,*.kt}]
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_name_count_to_use_star_import = 99
ij_kotlin_name_count_to_use_star_import_for_members = 99
ij_java_use_single_class_imports = true
max_line_length = 100
ij_any_wrap_long_lines = true

[*.java]
indent_style = space
# Doc: https://youtrack.jetbrains.com/issue/IDEA-170643#focus=streamItem-27-3708697.0-0
# $ means "static"
ij_java_imports_layout = $*,|,org.postgresql.**,|,*,|,java
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
tab_width = 2
max_line_length = 100
ij_any_spaces_around_additive_operators = true
ij_any_spaces_around_assignment_operators = true
ij_any_spaces_around_bitwise_operators = true
ij_any_spaces_around_equality_operators = true
ij_any_spaces_around_lambda_arrow = true
ij_any_spaces_around_logical_operators = true
ij_any_spaces_around_multiplicative_operators = true
ij_any_spaces_around_relational_operators = true
ij_any_spaces_around_shift_operators = true
ij_continuation_indent_size = 4
ij_java_if_brace_force = always
ij_java_indent_case_from_switch = false
ij_java_space_after_colon = true
ij_java_space_before_colon = true
ij_java_ternary_operation_signs_on_next_line = true
ij_java_use_single_class_imports = true
ij_java_wrap_long_lines = true
10 changes: 10 additions & 0 deletions .github/workflows/init-user-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

whoami

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER test;
CREATE DATABASE test OWNER test;
CREATE USER root;
EOSQL
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners
# GitHub Actions does not support Docker, PostgreSQL server on Windows, macOS :(

jobs:
ubuntu-latest:
name: 'Ubuntu, PG latest (JDK 8)'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
# Empty password
# POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: >-
--name db
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Setup Users
uses: docker://docker
with:
args: docker exec -t db psql -U postgres -c "set password_encryption='scram-sha-256'; create user test with password 'test';"
- name: Create DB
uses: docker://docker
with:
args: docker exec -t db psql -U postgres -c "create database test owner test;"
- uses: actions/checkout@master
with:
fetch-depth: 50
- name: 'Set up JDK 8'
uses: actions/setup-java@v1
with:
java-version: 8
# - name: 'Setup DB'
# run: |
# psql -U postgres -c "set password_encryption='scram-sha-256'; create user test with password 'test';"
# psql -U postgres -c 'create database test owner test;'
# psql -U postgres test -c 'CREATE EXTENSION hstore;'
- name: 'Test'
run: |
./gradlew --no-parallel --no-daemon -PskipReplicationTests test javadoc -Pport=${{ job.services.postgres.ports['5432'] }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.classpath
.gradle
.settings
.project
.checkstyle
Expand All @@ -16,6 +17,8 @@ nbproject
*-dist.zip
*.po.~*~
target/
build/
*/build/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
Expand Down
Empty file added .ratignore
Empty file.
186 changes: 9 additions & 177 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ stages:
if: branch =~ ^release\/.*$

before_script:
- test $(grep "after_n_builds" codecov.yml | tr -d '[:space:]' | cut -d":" -f2) -eq $(grep -e "COVERAGE=Y$" .travis.yml | wc -l) || exit 1
# TODO: restore when the number of Travis jobs is back to normal (coverage)
#- test $(grep "after_n_builds" codecov.yml | tr -d '[:space:]' | cut -d":" -f2) -eq $(grep -e "COVERAGE=Y$" .travis.yml | wc -l) || exit 1
- export PG_DATADIR="/etc/postgresql/${PG_VERSION}/main"
- export PG_SLAVE1_DATADIR="/etc/postgresql/${PG_VERSION}/slave1"
- export PG_SLAVE2_DATADIR="/etc/postgresql/${PG_VERSION}/slave2"
Expand Down Expand Up @@ -69,7 +70,8 @@ script:

before_cache:
# No sense in caching current build artifacts
- rm -rf $HOME/.m2/repository/org/postgresql
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- find $HOME/.ivy2 -name "ivydata-*.properties" -delete
- find $HOME/.sbt -name "*.lock" -delete

Expand All @@ -79,8 +81,8 @@ install: true

cache:
directories:
- $HOME/.m2/repository
- $HOME/.ivy2/cache
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.sbt/boot/

matrix:
Expand All @@ -89,186 +91,16 @@ matrix:
- stage: test
jdk: oraclejdk8
env: RUN_CHECKSTYLE=true
script: mvn checkstyle:check
- env:
- FEDORA_CI=Y
services:
- docker
if: type != pull_request
- jdk: openjdk-ea
sudo: required
addons:
postgresql: "10"
env:
- PG_VERSION=10
- JDK=12
- TZ=America/New_York # flips between −05:00 and −04:00
- jdk: openjdk-ea
sudo: required
addons:
postgresql: "11"
env:
- PG_VERSION=11
- XA=true
- COVERAGE=Y
- NO_HSTORE=Y
- PLPGSQL_EXTENSION=Y
- jdk: oraclejdk9
sudo: required
addons:
postgresql: "11"
env:
- PG_VERSION=11
- XA=true
- COVERAGE=Y
- NO_HSTORE=Y
- PLPGSQL_EXTENSION=Y
- JDK=9
- jdk: oraclejdk8
sudo: required
addons:
postgresql: "11"
env:
- PG_VERSION=11
- XA=true
- COVERAGE=Y
- NO_HSTORE=Y
- PLPGSQL_EXTENSION=Y
- JDK=8
script: ./gradlew autostyleCheck checkstyleAll
- jdk: oraclejdk11
sudo: required
addons:
postgresql: "10"
env:
- PG_VERSION=10
- JDK=11
- TZ=America/New_York # flips between −05:00 and −04:00
- jdk: oraclejdk9
addons:
postgresql: "9.6"
env:
- PG_VERSION=9.6
- JDK=9
- TZ=America/New_York # flips between −05:00 and −04:00
- jdk: oraclejdk8
sudo: required
env:
- PG_VERSION=HEAD
- XA=true
- REPLICATION=Y
- COVERAGE=Y
- TEST_CLIENTS=Y
- TZ=Pacific/Chatham # flips between +12:45 and +13:45
- JDK=8
- jdk: oraclejdk8
sudo: required
addons:
postgresql: "9.6"
env:
- PG_VERSION=9.6
- ZULU_JDK=8
- XA=true
- REPLICATION=Y
- COVERAGE=Y
- MCENTRAL=Y
- JDOC=Y
- jdk: oraclejdk8
sudo: required
addons:
postgresql: "9.5"
env:
- PG_VERSION=9.5
- XA=true
- REPLICATION=Y
- JDK=8
- jdk: oraclejdk8
addons:
postgresql: "9.4"
env:
- PG_VERSION=9.4
- QUERY_MODE=extendedCacheEverything
- COVERAGE=Y
- TZ=Europe/Moscow # +03:00, no DST
- JDK=8
- jdk: oraclejdk8
sudo: required
addons:
postgresql: "10"
env:
- PG_VERSION=10
- SSLTEST=Y
- COVERAGE=Y
- JDK=8
- jdk: openjdk7
sudo: required
addons:
postgresql: "9.2"
env:
- PG_VERSION=9.2
- ZULU_JDK=7
- MCENTRAL=Y
- COVERAGE=Y
- TZ=UTC
- jdk: openjdk7
sudo: required
addons:
postgresql: "9.1"
env:
- PG_VERSION=9.1
- ZULU_JDK=6
- MCENTRAL=Y
- jdk: oraclejdk8
sudo: required
env:
- PG_VERSION=8.4
- XA=true
- COVERAGE=Y
- NO_HSTORE=Y
- CREATE_PLPGSQL=Y
- jdk: oraclejdk8
addons:
postgresql: "9.6"
env:
- PG_VERSION=9.6
- QUERY_MODE=simple
- COVERAGE=Y
- JDK=11
- TZ=America/New_York # flips between −05:00 and −04:00
- TEST_CLIENTS=Y
- JDK=8
- jdk: oraclejdk8
addons:
postgresql: "9.3"
env:
- PG_VERSION=9.3
- QUERY_MODE=extendedForPrepared
- COVERAGE=Y
- JDK=8
- jdk: oraclejdk8
addons:
postgresql: "9.4"
env:
- PG_VERSION=9.4
- NO_WAFFLE_NO_OSGI=Y
- JDK=8
- stage: release
jdk: oraclejdk8
env:
- PG_VERSION=9.6
- stage: release_prev
jdk: openjdk7
sudo: required
addons:
postgresql: "9.2"
env:
- PG_VERSION=9.2
- ZULU_JDK=7
- stage: release_prev
jdk: openjdk7
sudo: required
addons:
postgresql: "9.1"
env:
- PG_VERSION=9.1
- ZULU_JDK=6

# Deploy snapshots to Maven Central
after_success:
Expand Down

0 comments on commit 819e000

Please sign in to comment.