Skip to content

Commit

Permalink
Merge branch 'develop' into feature/repository-access-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEntholzer authored Aug 19, 2024
2 parents af3cd22 + f6b45e0 commit b0e1d72
Show file tree
Hide file tree
Showing 19 changed files with 729 additions and 157 deletions.
79 changes: 53 additions & 26 deletions .github/workflows/analysis-of-endpoint-connections.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
name: Analysis of Endpoint Connections

on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
paths:
- 'src/main/java/**'
- 'src/main/webapp/**'
push:

# Keep in sync with build.yml and test.yml and codeql-analysis.yml
env:
Expand All @@ -15,7 +11,7 @@ env:
java: 21

jobs:
analysis-of-endpoint-connections:
Parse-rest-calls-and-endpoints:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
Expand All @@ -24,39 +20,70 @@ jobs:
with:
fetch-depth: 0

- name: Get list of modified files
run: |
git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD > modified_files.txt
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '${{ env.java }}'
distribution: 'temurin'
cache: 'gradle'

# Analyze the client sided REST-API calls
- name: Set up Node.js
- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: '${{ env.node }}'

- name: Install and compile TypeScript
- name: Parse client sided REST-API calls
run: |
cd supporting_scripts/analysis-of-endpoint-connections/src/main/typeScript/
npm install
tsc -p tsconfig.analysisOfEndpointConnections.json
- name: Run analysis-of-endpoint-connections-client
run: |
tsc -p supporting_scripts/analysis-of-endpoint-connections/src/main/typeScript/tsconfig.analysisOfEndpointConnections.json
node supporting_scripts/analysis-of-endpoint-connections/src/main/typeScript/AnalysisOfEndpointConnectionsClient.js
- name: Upload JSON file
- name: Parse server sided Endpoints
run: ./gradlew :supporting_scripts:analysis-of-endpoint-connections:runEndpointParser

- name: Upload parsing results
uses: actions/upload-artifact@v4
with:
name: rest-calls-json
path: supporting_scripts/analysis-of-endpoint-connections/restCalls.json
name: REST API Parsing Results
path: |
supporting_scripts/analysis-of-endpoint-connections/endpoints.json
supporting_scripts/analysis-of-endpoint-connections/restCalls.json
Analysis-of-endpoint-connections:
needs: Parse-rest-calls-and-endpoints
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

# Analyze the server sided endpoints
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '${{ env.java }}'
cache: 'gradle'

- name: Run analysis-of-endpoint-connections
run: |
./gradlew :supporting_scripts:analysis-of-endpoint-connections:run --args="$(cat modified_files.txt)"
- name: Download JSON files
uses: actions/download-artifact@v4
with:
name: REST API Parsing Results
path: supporting_scripts/analysis-of-endpoint-connections/

- name: Analyze endpoints
run:
./gradlew :supporting_scripts:analysis-of-endpoint-connections:runEndpointAnalysis

- name: Analyze rest calls
run:
./gradlew :supporting_scripts:analysis-of-endpoint-connections:runRestCallAnalysis

- name: Upload analysis results
uses: actions/upload-artifact@v4
with:
name: Endpoint and REST Call Analysis Results
path: |
supporting_scripts/analysis-of-endpoint-connections/endpointAnalysisResult.json
supporting_scripts/analysis-of-endpoint-connections/restCallAnalysisResult.json
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pluginManagement {

rootProject.name = 'Artemis'

// needed for rest call and endpoint analysis
include 'supporting_scripts:analysis-of-endpoint-connections'

// needed for programming exercise templates
Expand Down
24 changes: 15 additions & 9 deletions supporting_scripts/analysis-of-endpoint-connections/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ repositories {
evaluationDependsOn(':')

dependencies {
implementation rootProject.ext.qDoxVersionReusable
implementation 'com.github.javaparser:javaparser-symbol-solver-core:3.26.0'
implementation 'com.github.javaparser:javaparser-core:3.26.0'
implementation 'com.github.javaparser:javaparser-core-serialization:3.26.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
implementation rootProject.ext.springBootStarterWeb
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'ch.qos.logback:logback-classic:1.2.6'
}

test {
useJUnitPlatform()
task runEndpointParser(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'de.tum.cit.endpointanalysis.EndpointParser'
}

application {
mainClassName = 'de.tum.cit.endpointanalysis.AnalysisOfEndpointConnections'
task runEndpointAnalysis(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'de.tum.cit.endpointanalysis.EndpointAnalyzer'
}

run {
if (project.hasProperty('appArgs')) {
args = project.appArgs.split(' ')
}
task runRestCallAnalysis(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'de.tum.cit.endpointanalysis.RestCallAnalyzer'
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,5 @@
"jsx": true
}
},
"rules": {},
"settings": {
"react": {
"version": "detect"
}
}
"rules": {}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package de.tum.cit.endpointanalysis;

import java.util.List;

public record EndpointAnalysis(List<UsedEndpoints> usedEndpoints, List<EndpointInformation> unusedEndpoints) {
}
Loading

0 comments on commit b0e1d72

Please sign in to comment.