Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST OH2-246 #398

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 16 additions & 57 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,22 @@ on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
persist-credentials: false

- name: Checkout core
run: git clone --depth=50 --branch=develop https://github.com/informatici/openhospital-core.git openhospital-core

- name: Install core
run: cd openhospital-core && mvn install -DskipTests=true && cd ..

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Generate JWT Token
id: jwt
run: echo "token=7DlyD1SHR5pCa4HGgTLWSYm8YQ7oRL1wpPbxyjWyHU44vUrqrooRu3lHVFSXWChesc" >> $GITHUB_OUTPUT

- name: Store branch name
id: extract_branch
run: |
if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
echo "branch=$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT
elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
echo "branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
else
echo "branch=INVALID_EVENT_BRANCH_UNKNOWN" >> $GITHUB_OUTPUT
fi

- name: Build with Maven
run: |
cp rsc/application.properties.dist rsc/application.properties
cp rsc/database.properties.dist rsc/database.properties
cp rsc/log4j.properties.dist rsc/log4j.properties
cp rsc/settings.properties.dist rsc/settings.properties
sed -e "s/JWT_TOKEN_SECRET/${{ steps.jwt.outputs.token }}/g" rsc/application.properties.dist > rsc/application.properties
mvn install -DskipTests=true
echo ${{ steps.extract_branch.outputs.branch }}

- name: Run API
run: |
cd target
java -cp "openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.JarLauncher &
sleep 60

- name: Generate OpenAPI yaml
run: mvn springdoc-openapi:generate

- name: Update PR with OpenAPI specs changes (if any)
uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit-message: "GitHub Action: update openapi"
path: "openapi"
branch: ${{ steps.extract_branch.outputs.branch }}
- uses: actions/checkout@v2

- name: Checkout core
run: git clone --depth=50 --branch=develop https://github.com/informatici/openhospital-core.git openhospital-core

- name: Install core
run: cd openhospital-core && mvn install -DskipTests=true && cd ..

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Build with Maven
run: mvn -B package --file pom.xml
69 changes: 69 additions & 0 deletions .github/workflows/openapi_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow will update OpenAPI specs file

name: OpenAPI update

on:
pull_request:
types:
- opened
- synchronize

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
persist-credentials: false

- name: Checkout core
run: git clone --depth=50 --branch=develop https://github.com/informatici/openhospital-core.git openhospital-core

- name: Install core
run: cd openhospital-core && mvn install -DskipTests=true && cd ..

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Generate JWT Token
id: jwt
run: echo "token=7DlyD1SHR5pCa4HGgTLWSYm8YQ7oRL1wpPbxyjWyHU44vUrqrooRu3lHVFSXWChesc" >> $GITHUB_OUTPUT

- name: Store branch name
id: extract_branch
run: |
echo "branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT

- name: Build with Maven
run: |
cp rsc/application.properties.dist rsc/application.properties
cp rsc/database.properties.dist rsc/database.properties
cp rsc/log4j.properties.dist rsc/log4j.properties
cp rsc/settings.properties.dist rsc/settings.properties
sed -e "s/JWT_TOKEN_SECRET/${{ steps.jwt.outputs.token }}/g" rsc/application.properties.dist > rsc/application.properties
mvn install -DskipTests=true

- name: Run API
run: |
cd target
java -cp "openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.JarLauncher &
sleep 60

- name: Generate OpenAPI yaml
run: mvn springdoc-openapi:generate

- name: Update PR with OpenAPI specs changes (if any)
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git clone --depth=1 --branch="${{ steps.extract_branch.outputs.branch }}" https://${{ github.repository_owner }}:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository_owner }}/openhospital-api.git origin-branch
cp -r openapi origin-branch/
cd origin-branch
git add .
git commit -m "Update OpenAPI specs"
git push origin "${{ steps.extract_branch.outputs.branch }}"
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
1 change: 1 addition & 0 deletions TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TEST file for OH2-246
Loading