Fix checkstyle #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- '*' | |
paths-ignore: | |
- 'docs/**' | |
- '**/*.md' | |
- 'appveyor.xml' | |
- '.travis.yml' | |
- '.travis/**' | |
pull_request: | |
branches: | |
- '**' | |
paths-ignore: | |
- 'docs/**' | |
- '**/*.md' | |
- 'appveyor.xml' | |
- '.travis.yml' | |
- '.travis/**' | |
permissions: | |
contents: read | |
# 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 :( | |
concurrency: | |
# On master/release, we don't want any jobs cancelled so the sha is used to name the group | |
# On PR branches, we cancel the job if new commits are pushed | |
# More info: https://stackoverflow.com/a/68422069/253468 | |
group: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release' ) && format('ci-main-{0}', github.sha) || format('ci-main-{0}', github.ref) }} | |
cancel-in-progress: true | |
jobs: | |
code-style: | |
name: 'Code style' | |
runs-on: ubuntu-latest | |
env: | |
ACTIONS_STEP_DEBUG: true | |
ACTIONS_RUNNER_DEBUG: true | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- name: 'Set up JDK 8' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Verify code style | |
env: | |
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }} | |
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }} | |
with: | |
job-id: jdk17 | |
arguments: styleCheck jandex | |
linux-checkerframework: | |
name: 'CheckerFramework' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- name: 'Set up JDK 17' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Run CheckerFramework | |
env: | |
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }} | |
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }} | |
with: | |
read-only: ${{ matrix.os == 'self-hosted' }} | |
job-id: checker-jdk17 | |
arguments: --scan --no-parallel --no-daemon -PenableCheckerframework classes | |
source-distribution-check: | |
name: 'Source distribution (JDK 17)' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- name: Start PostgreSQL | |
working-directory: docker/postgres-server | |
run: docker-compose up -d && docker-compose logs | |
- name: 'Set up JDK 17' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Prepare source distribution | |
env: | |
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }} | |
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }} | |
with: | |
job-id: source-release-jdk17 | |
arguments: --scan --no-parallel --no-daemon sourceDistribution -Ppgjdbc.version=1.0 -Prelease | |
- name: Verify source distribution | |
working-directory: pgjdbc/build/distributions | |
run: | | |
tar xzf postgresql-1.0-jdbc-src.tar.gz | |
cd postgresql-1.0-jdbc-src | |
mvn --batch-mode --fail-at-end --show-version verify | |
- name: Attach heap dump if any | |
if: ${{ failure() && github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pgjdbc-heapdump-source-distribution | |
path: pgjdbc/build/distributions/postgresql-1.0-jdbc-src/target/surefire-reports/*.hprof | |
matrix_prep: | |
name: Matrix Preparation | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
env: | |
MATRIX_JOBS: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- id: set-matrix | |
run: | | |
node .github/workflows/matrix.js | |
build-test: | |
name: '${{ matrix.name }}' | |
runs-on: ${{ matrix.os }} | |
needs: matrix_prep | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}} | |
env: | |
ACTIONS_STEP_DEBUG: true | |
ACTIONS_RUNNER_DEBUG: true | |
TZ: ${{ matrix.tz }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- name: Start PostgreSQL PGV=${{ matrix.pg_version }} TZ=${{ matrix.server_tz }} XA=${{ matrix.xa }} SSL=${{ matrix.ssl }} SCRAM=${{ matrix.scram }} CREATE_REPLICAS=${{ matrix.replication }} | |
working-directory: docker/postgres-server | |
env: | |
PGV: ${{ matrix.pg_version }} | |
TZ: ${{ matrix.server_tz }} | |
XA: ${{ matrix.xa }} | |
SSL: ${{ matrix.ssl }} | |
SCRAM: ${{ matrix.scram }} | |
CREATE_REPLICAS: ${{ matrix.replication }} | |
# The below run command is long, however, it is intentional, and it makes the output nicer in GitHub UI | |
run: | | |
echo 'Starting PostgreSQL via docker-compose down; PGV=${{ matrix.pg_version }} TZ=${{ matrix.server_tz }} XA=${{ matrix.xa }} SSL=${{ matrix.ssl }} SCRAM=${{ matrix.scram }} CREATE_REPLICAS=${{ matrix.replication }} docker-compose up' | |
docker-compose down -v --rmi local || true | |
sed -i -r '/- (543[3-4]):\1/d' docker-compose.yml | |
docker-compose up -d | |
docker-compose logs | |
- name: Set up Java 17 and ${{ matrix.non_ea_java_version }}, ${{ matrix.java_distribution }}, ${{ runner.arch }} | |
uses: actions/setup-java@v3 | |
with: | |
# The latest one will be the default, so we use Java 17 for launching Gradle | |
# oracle-actions/setup-java below requires Java 17, so we must install Java 17 before calling oracle-actions/setup-java | |
java-version: | | |
${{ matrix.non_ea_java_version }} | |
17 | |
distribution: ${{ matrix.java_distribution }} | |
# Architecture is explicit to workaround https://github.com/actions/setup-java/issues/559 | |
architecture: ${{ runner.arch == 'ARM64' && 'aarch64' || 'x64' }} | |
- name: Set up Java ${{ matrix.java_version }}, oracle | |
id: setup_ea_java | |
if: ${{ matrix.oracle_java_website != '' }} | |
uses: oracle-actions/setup-java@7a0114d66dbd02646abd345c3395b34c148e6126 # v1.3.2 | |
env: | |
JAVA_HOME_17_X64: ${{ env.JAVA_HOME_17_AARCH64 || env.JAVA_HOME_17_X64 }} | |
with: | |
website: ${{ matrix.oracle_java_website }} | |
release: ${{ matrix.java_version }} | |
- name: Set up Java 17 ${{ matrix.java_distribution }} as default | |
# oracle-actions/setup-java above installs EA java by default, so we need to reinstall Java 17 as the default | |
if: ${{ matrix.oracle_java_website != '' }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: ${{ matrix.java_distribution }} | |
# Architecture is explicit to workaround https://github.com/actions/setup-java/issues/559 | |
architecture: ${{ runner.arch == 'ARM64' && 'aarch64' || 'x64' }} | |
- name: Prepare local properties | |
run: | | |
# See https://github.com/actions/runner/issues/409 | |
cat <<EOF >ssltest.local.properties | |
enable_ssl_tests=${{ matrix.ssl == 'yes' && 'true' || 'false' }} | |
EOF | |
cat <<EOF >build.local.properties | |
preferQueryMode=${{ matrix.query_mode }} | |
EOF | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Test | |
env: | |
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }} | |
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }} | |
_JAVA_OPTIONS: ${{ matrix.extraJvmArgs }} | |
with: | |
read-only: ${{ matrix.os == 'self-hosted' }} | |
job-id: jdk${{ matrix.java_version }} | |
arguments: --scan --no-parallel --no-daemon jandex test ${{ matrix.extraGradleArgs }} | |
properties: | | |
includeTestTags=${{ matrix.includeTestTags }} | |
testExtraJvmArgs=${{ matrix.testExtraJvmArgs }} | |
jdkBuildVersion=17 | |
jdkTestVersion=${{ matrix.java_version == 'EA' && steps.setup_ea_java.outputs.version || matrix.java_version }} | |
jdkTestVendor=${{ matrix.java_vendor }} | |
# We provision JDKs with GitHub Actions for caching purposes, so Gradle should rather fail in case JDK is not found | |
org.gradle.java.installations.auto-download=false | |
- name: 'Install krb5 for GSS tests' | |
if: ${{ matrix.gss == 'yes' }} | |
run: | | |
sudo apt -y update | |
sudo apt -y install krb5-kdc krb5-admin-server libkrb5-dev postgresql | |
- name: 'Update hosts for GSS tests' | |
if: ${{ matrix.gss == 'yes' }} | |
run: | | |
sudo -- sh -c "echo 127.0.0.1 localhost auth-test-localhost.postgresql.example.com > /etc/hosts" | |
cat /etc/hosts | |
- uses: burrunan/gradle-cache-action@v1 | |
if: ${{ matrix.deploy_to_maven_local }} | |
name: Deploy pgjdbc to mavenLocal | |
with: | |
read-only: ${{ matrix.os == 'self-hosted' }} | |
job-id: jdk${{ matrix.java_version }} | |
arguments: publishToMavenLocal -Ppgjdbc.version=1.0.0-dev-master -PskipJavadoc | |
- name: Attach heap dump if any | |
if: ${{ failure() && github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pgjdbc-heapdump | |
path: pgjdbc/*.hprof | |
- name: Test GSS | |
if: ${{ matrix.gss == 'yes' }} | |
run: | | |
cd test-gss | |
./gradlew assemble | |
./gradlew run | |
env: | |
KRB5CCNAME: /home/runner/work/pgjdbc/pgjdbc/test-gss/tmp_check/krb5cc | |
KRB5_CONFIG: /home/runner/work/pgjdbc/pgjdbc/test-gss/tmp_check/krb5.conf | |
KRB5_KDC_PROFILE: /home/runner/work/pgjdbc/pgjdbc/test-gss/tmp_check/kdc.conf | |
- name: Test anorm-sbt | |
if: ${{ matrix.check_anorm_sbt == 'yes' }} | |
run: | | |
# mkdir -p $HOME/.sbt/launchers/0.13.12 | |
# curl -L -o $HOME/.sbt/launchers/0.13.12/sbt-launch.jar http://dl.bintray.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.12/sbt-launch.jar | |
cd test-anorm-sbt | |
sbt test | |
- name: Cleanup Docker | |
if: ${{ always() }} | |
working-directory: docker/postgres-server | |
run: | | |
docker-compose ps | |
docker-compose down -v --rmi local |