|
name: Build & test |
|
on: |
|
push: |
|
branches: [ develop ] |
|
pull_request: |
|
branches: [ develop ] |
|
workflow_dispatch: |
|
repository_dispatch: |
|
types: [ utPLSQL-build ] |
|
|
|
defaults: |
|
run: |
|
shell: bash |
|
|
|
jobs: |
|
build: |
|
|
|
runs-on: ubuntu-latest |
|
env: |
|
DB_URL: "//localhost:1521/FREEPDB1" |
|
|
|
services: |
|
oracle: |
|
image: gvenzl/oracle-free:23-slim-faststart |
|
env: |
|
ORACLE_PASSWORD: oracle |
|
SERVICE_NAME: FREEPDB1 |
|
ports: |
|
- 1521:1521 |
|
options: >- |
|
--health-cmd healthcheck.sh |
|
--health-interval 10s |
|
--health-timeout 5s |
|
--health-retries 10 |
|
|
|
steps: |
|
- uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
|
|
- name: Install utPLSQL |
|
run: sh ${{ github.workspace }}/scripts/1_install_utplsql.sh |
|
|
|
- name: Install demo project |
|
run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh |
|
|
|
- name: Set up JDK 21 |
|
uses: actions/setup-java@v5 |
|
with: |
|
java-version: '21' |
|
distribution: 'temurin' |
|
server-id: central |
|
server-username: MAVEN_USERNAME |
|
server-password: MAVEN_PASSWORD |
|
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} |
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE |
|
|
|
- name: Cache local Maven repository |
|
uses: actions/cache@v4 |
|
with: |
|
path: ~/.m2/repository |
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
|
restore-keys: | |
|
${{ runner.os }}-maven- |
|
|
|
- name: Maven unit and integration tests |
|
run: mvn clean verify sonar:sonar -Pcoverage -Dsonar.projectKey=utPLSQL_utPLSQL-java-api |
|
env: |
|
GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} |
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
|
|
|
- name: Maven deploy snapshot |
|
if: github.event_name != 'pull_request' |
|
run: mvn deploy -DskipTests |
|
env: |
|
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} |
|
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} |
|
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
|
|
|
- name: Get project version |
|
if: github.event_name != 'pull_request' |
|
id: project_version |
|
run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT |
|
|
|
- name: Trigger utPLSQL-cli snapshot build |
|
if: github.event_name != 'pull_request' |
|
uses: peter-evans/repository-dispatch@v3 |
|
with: |
|
token: ${{ secrets.CLI_REPO_TOKEN }} |
|
repository: utPLSQL/utPLSQL-cli |
|
event-type: utPLSQL-java-api-build |
|
client-payload: '{"api_version": "${{ steps.project_version.outputs.version }}"}' |
|
|
|
- name: Trigger utPLSQL-maven-plugin snapshot build |
|
if: github.event_name != 'pull_request' |
|
uses: peter-evans/repository-dispatch@v3 |
|
with: |
|
token: ${{ secrets.CLI_REPO_TOKEN }} |
|
repository: utPLSQL/utPLSQL-maven-plugin |
|
event-type: utPLSQL-java-api-build |
|
client-payload: '{"api_version": "${{ steps.project_version.outputs.version }}"}' |
|
|
|
- name: Publish unit test results |
|
uses: EnricoMi/publish-unit-test-result-action@v2 |
|
if: always() |
|
with: |
|
files: target/**/TEST**.xml |