Skip to content

Commit

Permalink
Fix GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Feb 13, 2020
1 parent 819e000 commit e0ddf27
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 42 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/init-user-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ set -e
whoami

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER test;
SET password_encryption='scram-sha-256';
CREATE USER test with password 'test';
CREATE DATABASE test OWNER test;
CREATE USER root;
CREATE DATABASE root OWNER root;
EOSQL

/home/scripts/travis_ssl_users.sh
64 changes: 33 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,46 @@ 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
# Service must be started after checkout, because we want to use git-stored files for initialization
# of the Docker container. So we start it with and explicit docker ... command
# services:
# postgres:
# image: postgres:latest
# env:
# POSTGRES_USER: postgres
# # Empty password
# # POSTGRES_PASSWORD: postgres
# POSTGRES_DB: postgres
# ports:
# - 5432:5432
# volumes:
# - /home/runner/work/pgjdbc/pgjdbc/.travis:/scripts/.travis
# # 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: Start PostgreSQL
uses: docker://docker
with:
args: >-
docker run -d --rm --name pgdb -p 5432:5432
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
-v ${{ github.workspace }}/.github/workflows/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh
-v ${{ github.workspace }}/.travis/travis_ssl_users.sh:/home/scripts/travis_ssl_users.sh
-e "POSTGRES_USER=postgres" -e "POSTGRES_PASSWORD=" -e "POSTGRES_DB=postgres" -e GITHUB_ACTIONS=true
postgres:latest
- 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'] }}
./gradlew --no-parallel --no-daemon -PskipReplicationTests -Pport=${{ job.services.postgres.ports['5432'] }} test
# test javadoc -Pport=${{ job.services.postgres.ports['5432'] }}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ before_script:
- test "x$SSLTEST" == 'x' || ./.travis/travis_configure_ssl.sh
- ./.travis/travis_start_postgres.sh
- test "x$PG_VERSION" != 'xHEAD' || psql -U postgres -c "set password_encryption='scram-sha-256'; create user test with password 'test';"
- test "x$PG_VERSION" = 'xHEAD' || psql -U postgres -c "create user test with password 'test';"
- test "x$PG_VERSION" = 'xHEAD' || psql -U postgres -c "create user test with password 'test1';"
- test "x$REPLICATION" == 'x' || psql -U postgres -c "alter user test with replication;"
- psql -c 'create database test owner test;' -U postgres
- test "x$SSLTEST" == 'x' || ./.travis/travis_ssl_users.sh
Expand Down
2 changes: 1 addition & 1 deletion .travis/travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ then
fi

# Build project
GRADLE_ARGS="--no-daemon --stacktrace -PskipAutostyle -PskipCheckstyle -PskipReplicationTests build $MVN_CUSTOM_ARGS"
GRADLE_ARGS="--no-daemon -PskipAutostyle -PskipCheckstyle -PskipReplicationTests build $MVN_CUSTOM_ARGS"
MVN_PROFILES="release"

if [[ "${NO_WAFFLE_NO_OSGI}" == *"Y"* ]];
Expand Down
6 changes: 2 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import com.github.vlsi.gradle.crlf.LineEndings
import com.github.vlsi.gradle.git.FindGitAttributes
import com.github.vlsi.gradle.properties.dsl.props
import com.github.vlsi.gradle.properties.dsl.stringProperty
import com.github.vlsi.gradle.test.dsl.printTestResults
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

plugins {
publishing
Expand Down Expand Up @@ -81,6 +79,8 @@ allprojects {
group = "org.postgresql"
version = buildVersion

apply(plugin = "com.github.vlsi.gradle-extensions")

repositories {
if (enableMavenLocal) {
mavenLocal()
Expand Down Expand Up @@ -313,7 +313,6 @@ allprojects {
}
}
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
}
exclude("**/*Suite*")
Expand All @@ -340,7 +339,6 @@ allprojects {
"simpleProtocolOnly", "enable_ssl_tests")) {
passProperty(p)
}
printTestResults()
}
withType<SpotBugsTask>().configureEach {
group = LifecycleBasePlugin.VERIFICATION_GROUP
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pgjdbc.version=42.3.0
com.github.autostyle.version=3.0
com.github.johnrengelman.shadow.version=5.1.0
com.github.spotbugs.version=2.0.0
com.github.vlsi.vlsi-release-plugins.version=1.60
com.github.vlsi.vlsi-release-plugins.version=1.61
com.google.protobuf.version=0.8.10
de.thetaphi.forbiddenapis.version=2.7
kotlin.version=1.3.50
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=634f972af958e3c753aeb42d7a688fab6820b527a0aef9eed03d7f3f6f9c7c06
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-all.zip
distributionSha256Sum=10065868c78f1207afb3a92176f99a37d753a513dff453abb6b5cceda4058cda
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 2 additions & 1 deletion pgjdbc/src/test/java/org/postgresql/test/ssl/SslTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ private void checkErrorCodes(SQLException e) {
//#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.1"
firstError.addSuppressed(error);
//#endif
error.printStackTrace();
// TODO: this is needed for Java < 1.7. Should it be just removed?
// error.printStackTrace();
}

throw firstError;
Expand Down

0 comments on commit e0ddf27

Please sign in to comment.