Skip to content

#24 - Added tests cases #112

#24 - Added tests cases

#24 - Added tests cases #112

Workflow file for this run

name: Run tests for posjsonhelper
on:
push:
jobs:
integraion_tests:
# needs: [compilation_and_unit_tests]
runs-on: ubuntu-latest
name: "Integration and functional tests in core module"
services:
postgres:
image: postgres:10.22-bullseye
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_HOST: localhost
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Git checkout
uses: actions/checkout@v2
# Install JDKs and maven toolchain
- uses: actions/setup-java@v3
name: Set up JDK 11
id: setupJava11
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- uses: actions/setup-java@v3
name: Set up JDK 17
id: setupJava17
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
- name: Set up JDK 1.8
id: setupJava8
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: cactuslab/maven-toolchains-xml-action@v1
with:
toolchains: |
[
{"jdkVersion": "8", "jdkHome": "${{steps.setupJava8.outputs.path}}"},
{"jdkVersion": "11", "jdkHome": "${{steps.setupJava11.outputs.path}}"},
{"jdkVersion": "17", "jdkHome": "${{steps.setupJava17.outputs.path}}"}
]
- name: Install library for postgres
run: sudo apt-get update -y && sudo apt-get -y install libpq-dev postgresql-client
- name: Create database owner
run: export PGPASSWORD=postgres && psql -f 'test-utils/src/main/resources/create-database-owner.sql' -U postgres -h 127.0.0.1
- name: Create database
run: export PGPASSWORD=postgres && psql -f 'test-utils/src/main/resources/create-database.sql' -U postgres -h 127.0.0.1
- name: Create core module db and non public schema
run: export PGPASSWORD=postgres && psql -f 'test-utils/src/main/resources/create-database-core-database-and-data.sql' -U postgres -h 127.0.0.1
- name: Run tests
run: ./mvnw -DskipTests --quiet clean install && ./mvnw test
- name: Run mutation tests
run: ./mvnw -P pitest test org.pitest:pitest-maven:mutationCoverage
# Executing gmavenplus plugin
# https://github.com/groovy/GMavenPlus/issues/43
- uses: actions/setup-java@v3
name: Set up JDK 11 for hibernate6 tests
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- name: Run tests for hibernate6
run: ./mvnw -DskipTests --quiet clean install && ./mvnw -pl :hibernate6 -P jdk11 test
publish:
runs-on: ubuntu-latest
name: "Publish to the Maven Central Repository"
needs: [integraion_tests]
steps:
- name: Git checkout
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/checkout@v2
# Install JDKs and maven toolchain
- uses: actions/setup-java@v3
if: startsWith(github.ref, 'refs/tags/v')
name: Set up JDK 11
id: setupJava11
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- uses: actions/setup-java@v3
name: Set up JDK 17
id: setupJava17
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
- name: Set up JDK 1.8
id: setupJava8
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: cactuslab/maven-toolchains-xml-action@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
toolchains: |
[
{"jdkVersion": "8", "jdkHome": "${{steps.setupJava8.outputs.path}}"},
{"jdkVersion": "11", "jdkHome": "${{steps.setupJava11.outputs.path}}"},
{"jdkVersion": "17", "jdkHome": "${{steps.setupJava17.outputs.path}}"}
]
- name: Build with Maven
if: startsWith(github.ref, 'refs/tags/v')
run: ./deploy/release.sh
env:
GPG_KEYNAME: '${{ secrets.GPG_KEYNAME }}'
GPG_PASSPHRASE: '${{ secrets.GPG_PASSPHRASE }}'
ENCRYPTION_PASSWORD: '${{ secrets.ENCRYPTION_PASSWORD }}'
GPG_PUBLIC_KEYNAME: '${{ secrets.GPG_PUBLIC_KEYNAME }}'
MAVEN_USERNAME: '${{ secrets.POSJSONHELPER_MAVEN_USERNAME }}'
MAVEN_PASSWORD: '${{ secrets.POSJSONHELPER_MAVEN_PASSWORD }}'