Skip to content

Commit

Permalink
Merge branch 'develop' into developer-notifications-slack
Browse files Browse the repository at this point in the history
  • Loading branch information
GODrums authored Nov 6, 2024
2 parents 1680856 + 0fb30c7 commit 328820f
Show file tree
Hide file tree
Showing 46 changed files with 4,587 additions and 1,248 deletions.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Description
<!-- Provide a brief summary of the changes. -->

### Testing Instructions
<!-- Explain how to test the changes made in this PR. -->

### Screenshots (if applicable)
<!-- Attach screenshots here. -->

Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/application-server-qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Application-Server QA

on:
pull_request:
paths:
- "server/application-server/**"
- "!server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/**"
push:
paths:
- "server/application-server/**"
- "!server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/**"
branches: [develop]

jobs:
quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
- name: Run Prettier
run: npm run prettier:java:check
37 changes: 37 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Lint

on: [pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Python dependencies
working-directory: server/intelligence-service
run: poetry lock --no-update && poetry install --no-interaction --no-root

- name: Check formatting with Black
working-directory: ./server/intelligence-service
run: poetry run black --check .
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, synchronize, labeled, reopened]
paths:
- 'server/application-server/**'
- '.github/workflows/generate-api-client.yml'
- '.github/workflows/generate-application-server-client.yml'
push:
paths:
- 'server/application-server/openapi.yaml'
Expand All @@ -15,7 +15,7 @@ on:

jobs:
generate-api-client:
name: Verify API Specs and Client (add autocommit-openapi label to PR to auto-commit changes)
name: Verify API Specs and Client of the Application Server (add autocommit-openapi label to PR to auto-commit changes)
runs-on: ubuntu-latest

steps:
Expand All @@ -37,11 +37,17 @@ jobs:
distribution: 'temurin'
java-version: '21'

- name: Set up directories
working-directory: server/application-server
run: |
mkdir -p ./keycloak-data
chmod -R 755 ./keycloak-data
- name: Install dependencies
run: npm install

- name: Generate API client
run: npm run generate:api
- name: Generate API client for the application server
run: npm run generate:api:application-server

- name: Check for changes in the API
id: check_changes
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/generate-intelligence-service-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: OpenAPI

on:
pull_request:
types: [opened, synchronize, labeled, reopened]
paths:
- 'server/application-server/**'
- '.github/workflows/generate-intelligence-service-client.yml'
push:
paths:
- 'server/intelligence-service/openapi.yaml'
- 'server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/**'
branches: [develop]
workflow_dispatch:

jobs:
generate-api-client:
name: Verify API Specs and Client of the Intelligence Service (add autocommit-openapi label to PR to auto-commit changes)
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false
fetch-depth: 0

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install dependencies
run: npm install

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Python dependencies
working-directory: server/intelligence-service
run: poetry install --no-interaction --no-root

- name: Generate API client for the application server
working-directory: server/intelligence-service
run: poetry run npm run generate:api:intelligence-service

- name: Check for changes in the API
id: check_changes
run: |
echo "Checking for changes in the API client directory..."
git add .
if git diff --cached --quiet; then
echo "No changes detected in the API client directory."
echo "NO_CHANGES_DETECTED=true" >> $GITHUB_ENV
else
echo "Changes detected in the API client directory."
echo "NO_CHANGES_DETECTED=false" >> $GITHUB_ENV
exit 1
fi
- name: Commit files
if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'autocommit-openapi') }}
run: |
echo "Committing and pushing changes..."
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git commit -a -m "chore: update API specs and client"
- name: Push changes
if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'autocommit-openapi') }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_PAT }}
branch: ${{ github.event.pull_request.head.ref }}

- name: Remove autocommit-openapi label
if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'autocommit-openapi') }}
run: |
echo "Removing the autocommit-openapi label..."
curl --silent --fail-with-body -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/autocommit-openapi
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,7 @@ node_modules/

application-local.yml

server/application-server/postgres-data/
server/application-server/postgres-data/

# Java-Client creation temporary
tmp
18 changes: 12 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive",
"java.completion.importOrder": ["#"],
"[java]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"tailwindCSS.experimental.classRegex": [
"cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]",
"cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"
"cva\\(([^)]*)\\)",
"[\"'`]([^\"'`]*).*?[\"'`]",
"cn\\(([^)]*)\\)",
"[\"'`]([^\"'`]*).*?[\"'`]"
],
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.testing.pytestArgs": ["."],
"python.testing.pytestEnabled": true,
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.testing.pytestArgs": ["."],
"python.testing.pytestEnabled": true,
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
Expand Down
13 changes: 12 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ services:
- postgres
networks:
- app-network
healthcheck:
test: "wget -qO- http://localhost:8080/actuator/health || exit 1"
interval: 30s
timeout: 10s
retries: 5
start_period: 30s

postgres:
image: 'postgres:16'
Expand All @@ -28,7 +34,12 @@ services:
aliases:
- postgres
volumes:
- 'postgresql-data:/var/lib/postgresql/data'
- postgresql-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

networks:
app-network:
Expand Down
Loading

0 comments on commit 328820f

Please sign in to comment.