Skip to content

Commit

Permalink
Merge pull request #60 from PalladioSimulator/dr6817-patch-1
Browse files Browse the repository at this point in the history
Added a Retriever info file with version and date.
  • Loading branch information
dr6817 authored Feb 12, 2024
2 parents 93faca8 + 79b974e commit ca9acf4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
53 changes: 33 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,38 @@ runs:
distribution: "temurin"
java-version: "17"

- name: Create temporary directory
- name: Create Temporary Directory
shell: bash
run: |
TMP_DIR=$(mktemp -d)
echo "tmp_dir=$TMP_DIR" >> $GITHUB_ENV
mkdir $TMP_DIR/retriever_out
- name: Gather Retriever Info
shell: bash
run: |
RETRIEVER_INFO_FILE=${{ env.tmp_dir }}/retriever_out/retriever_info.md
echo "RETRIEVER_INFO_FILE=$RETRIEVER_INFO_FILE" >> $GITHUB_ENV
{
echo "# [Retriever](https://github.com/PalladioSimulator/Palladio-ReverseEngineering-Retriever) Report"
echo "| Version | Date |"
echo "| ------- | ---- |"
echo "| $(curl -sL ${{ github.api_url }}/repos/PalladioSimulator/Palladio-ReverseEngineering-Retriever/releases/latest | jq -r ".tag_name") | $(date -u) |"
} > $RETRIEVER_INFO_FILE
- name: Gather Git Repository Info
shell: bash
run: |
GIT_INFO_FILE=${{ env.tmp_dir }}/retriever_out/git_info.md
cd "${{ github.workspace }}/${{ inputs.source_path }}"
echo "GIT_INFO_FILE=$GIT_INFO_FILE" >> $GITHUB_ENV
{
echo "# Git repository information"
echo "| | |"
echo "|--- | ---|"
echo "## Git repository information"
echo "| Attribute | Value |"
echo "| -------------- | ----- |"
echo "| Repository URL | $(git config --get remote.origin.url) |"
echo "| Branch | $(git branch --show-current) |"
echo "| Commit | $(git log -1 --pretty=format:"%H") |"
echo "| Date | $(date -u) |"
} > $GIT_INFO_FILE
- name: Install Neofetch
Expand All @@ -67,7 +78,7 @@ runs:
SYSTEM_INFO_FILE=${{ env.tmp_dir }}/retriever_out/system_info.md
echo "SYSTEM_INFO_FILE=$SYSTEM_INFO_FILE" >> $GITHUB_ENV
{
echo "# System information"
echo "## System information"
echo "| Attribute | Value |"
echo "| --------- | ----- |"
neofetch os distro kernel cpu gpu memory --stdout | \
Expand All @@ -79,18 +90,18 @@ runs:
run: |
sudo apt install cloc
- name: Run cloc analysis
- name: Run cloc Analysis
shell: bash
run: |
CLOC_INFO_FILE=${{ env.tmp_dir }}/retriever_out/cloc.md
echo "CLOC_INFO_FILE=$CLOC_INFO_FILE" >> $GITHUB_ENV
{
echo "# Cloc analysis"
echo "## Cloc analysis"
cloc ${{ inputs.source_path }} --unicode --autoconf --diff-timeout 300 --docstring-as-code --read-binary-files --md --quiet | \
sed -e '1d; 2s/cloc|github.com\/AlDanial\///; /^--- | ---$/d'
} > $CLOC_INFO_FILE
- name: Get action version
- name: Get Action Version
shell: bash
# Assuming a format like in the GitHub Actions documentation:
# /home/runner/work/_actions/repo-owner/name-of-action-repo/v1
Expand All @@ -100,7 +111,7 @@ runs:
ACTION_VERSION=$(echo ${{ github.action_path }} | cut -d / -f 8- -)
echo "action_version=$ACTION_VERSION" >> $GITHUB_ENV
- name: Download latest Retriever
- name: Download Latest Retriever
if: env.action_version == 'main'
shell: bash
run: |
Expand Down Expand Up @@ -129,7 +140,7 @@ runs:
working-directory: ${{ env.tmp_dir }}
run: unzip retriever.zip -d retriever

- name: Install Hyperfine
- name: Install hyperfine
if: inputs.benchmark == 'true'
shell: bash
run: |
Expand Down Expand Up @@ -162,7 +173,7 @@ runs:
# Remove the first column from the table using sed
sed -i 's/^[^|]*|[^|]*|/|/' $TIMING_INFO_FILE
{
echo "# Retriever execution time"
echo "## Retriever execution time"
cat $TIMING_INFO_FILE
} > "${TIMING_INFO_FILE}.tmp" && mv "${TIMING_INFO_FILE}.tmp" "$TIMING_INFO_FILE"
Expand All @@ -171,7 +182,7 @@ runs:
/usr/bin/time -p -o "$TIMING_INFO_FILE" $RETRIEVER_COMMAND
# Read and reformat the timing information
{
echo "# Retriever execution time"
echo "## Retriever execution time"
echo "| Metric | Time (seconds) |"
echo "| --- | ---: |"
while IFS= read -r line; do
Expand All @@ -197,19 +208,21 @@ runs:
run: |
# Combine files into one, with empty lines between file contents
{
cat $RETRIEVER_INFO_FILE
echo
cat $GIT_INFO_FILE
echo
cat $SYSTEM_INFO_FILE
echo
cat $TIMING_INFO_FILE
echo
cat $CLOC_INFO_FILE
} > ${{ env.tmp_dir }}/retriever_out/report.md
} > ${{ env.tmp_dir }}/retriever_out/README.md
# Delete the original files
rm -f $GIT_INFO_FILE $SYSTEM_INFO_FILE $CLOC_INFO_FILE $TIMING_INFO_FILE
rm -f $RETRIEVER_INFO_FILE $GIT_INFO_FILE $SYSTEM_INFO_FILE $CLOC_INFO_FILE $TIMING_INFO_FILE
- name: Prepare analysis results for upload
- name: Prepare Analysis Results for Upload
shell: bash
working-directory: ${{ env.tmp_dir }}
run: |
Expand All @@ -218,28 +231,28 @@ runs:
mv tmp/* retriever_out
rmdir tmp
- name: Upload analysis results
- name: Upload Analysis Results
uses: actions/upload-artifact@v3
with:
name: retriever
path: ${{ env.tmp_dir }}/retriever_out

- name: Prepare Eclipse logs for upload
- name: Prepare Eclipse Logs for Upload
if: failure()
shell: bash
working-directory: ${{ env.tmp_dir }}
run: |
mkdir -p eclipse_logs/${{ inputs.source_path }}
mv retriever/configuration/*.log retriever/workspace/.metadata/.log eclipse_logs/${{ inputs.source_path }}
- name: Upload Eclipse logs
- name: Upload Eclipse Logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: eclipse_logs
path: ${{ env.tmp_dir }}/eclipse_logs

- name: Delete temporary directory
- name: Delete Temporary Directory
if: always()
shell: bash
run: rm -rf ${{ env.tmp_dir }}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private static void executeWith(final Path projectPath, final Path outPath, fina

// Persist the repository at ./pcm.repository
blackboard.addPartition(RetrieverBlackboard.KEY_REPOSITORY, pcm);
ModelSaver.saveRepository(pcm, outPath.toString(), "pcm");
// ModelSaver.saveRepository(pcm, outPath.toString(), "pcm");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ private OperationInterface getConflictingMethods(final List<Interface> interface
return conflictingMethods;
}

/**
* Tests the basic functionality of Retriever. Requires it to execute without an exception and
* produce an output file.
*/
@Test
void testExecutesAndProducesFile() {
assertTrue(new File(this.getConfig()
.getOutputFolder()
.appendSegment("pcm.repository")
.devicePath()).exists());
}

@Disabled("FIXME: Reliance on outdated JaxRS rule")
@Test
void testArray() {
Expand Down

0 comments on commit ca9acf4

Please sign in to comment.