Skip to content

Commit

Permalink
Issue #8539: change diff trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
strkkk authored and romani committed Jul 25, 2020
1 parent 6e65ddf commit ba1f9cc
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions .github/workflows/diff_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ on:
jobs:
# Parse PR Body, search for links to .properties and .xml files
parse_body:
if: github.event.comment.body == 'diff report' ||
github.event.comment.body == 'single report'
if: github.event.comment.body == 'GitHub, generate report'
runs-on: ubuntu-latest
outputs:
project_link: ${{ steps.parse.outputs.project_link }}
config_link: ${{ steps.parse.outputs.config_link }}
new_module_config_link: ${{ steps.parse.outputs.new_module_config_link }}
patch_config: ${{ steps.parse.outputs.patch_config }}
user: ${{ steps.branch.outputs.user }}
branch: ${{ steps.branch.outputs.ref }}
Expand All @@ -44,13 +44,19 @@ jobs:
- name: Parsing content of PR description
id: parse
run: |
grep "^Diff Regression projects:" text > temp || echo "" > temp
sed 's/Diff Regression projects: //' temp > project
echo ::set-output name=project_link::$(cat project)
grep "^Diff Regression config:" text > temp || echo "" > temp
sed 's/Diff Regression config: //' temp > config
echo ::set-output name=config_link::$(cat config)
grep "^Diff Regression patch config:" text > temp || echo "" > temp
grep "^Diff Regression projects:" text | cat > temp
sed 's/Diff Regression projects: //' temp > project_link
echo ::set-output name=project_link::$(cat project_link)
grep "^Diff Regression config:" text | cat > temp
sed 's/Diff Regression config: //' temp > config_link
echo ::set-output name=config_link::$(cat config_link)
grep "^New module config:" text | cat > temp
sed 's/New module config: //' temp > new_module_config_link
echo ::set-output name=new_module_config_link::$(cat new_module_config_link)
grep "^Diff Regression patch config:" text | cat > temp
sed 's/Diff Regression patch config: //' temp > patch_config
echo ::set-output name=patch_config::$(cat patch_config)
Expand All @@ -64,15 +70,25 @@ jobs:
make_report:
runs-on: ubuntu-latest
needs: parse_body
if: needs.parse_body.outputs.project_link != '' && needs.parse_body.outputs.config_link != ''
if: needs.parse_body.outputs.project_link != ''
&& (needs.parse_body.outputs.config_link != ''
|| needs.parse_body.outputs.new_module_config_link != '')
outputs:
message: ${{ steps.out.outputs.message}}
steps:

- name: Download files
run: |
wget -q "${{needs.parse_body.outputs.project_link}}" -O project.properties
wget -q "${{needs.parse_body.outputs.config_link}}" -O config.xml
if [ ! -z "${{needs.parse_body.outputs.new_module_config_link}}" ]; then
wget -q "${{needs.parse_body.outputs.new_module_config_link}}" -O new_module_config.xml
fi
if [ ! -z "${{needs.parse_body.outputs.config_link}}" ]; then
wget -q "${{needs.parse_body.outputs.config_link}}" -O diff_config.xml
fi
if [ ! -z "${{needs.parse_body.outputs.patch_config}}" ]; then
wget -q "${{needs.parse_body.outputs.patch_config}}" -O patch_config.xml
fi
Expand Down Expand Up @@ -100,11 +116,8 @@ jobs:

- name: Prepare environment
run: |
mv config.xml ./contribution/checkstyle-tester/
mv project.properties ./contribution/checkstyle-tester/
if [ -f patch_config.xml ]; then
mv patch_config.xml ./contribution/checkstyle-tester/
fi
mv *.xml ./contribution/checkstyle-tester/
sudo apt install groovy
- name: Configure AWS Credentials
Expand All @@ -114,29 +127,22 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Generate basic difference report
if: github.event.comment.body == 'diff report'
- name: Generate report
run: |
cd contribution/checkstyle-tester
bash
REF="origin/${{needs.parse_body.outputs.branch}}"
REPO="../../checkstyle"
if [ -f patch_config.xml ]; then
groovy diff.groovy -r $REPO -b master -p $REF -bc config.xml -pc patch_config.xml\
if [ -f new_module_config.xml ]; then
groovy diff.groovy -r $REPO -p $REF -pc new_module_config.xml -m single\
-l project.properties
elif [ -f patch_config.xml ]; then
groovy diff.groovy -r $REPO -b master -p $REF -bc diff_config.xml -pc patch_config.xml\
-l project.properties
else
groovy diff.groovy -r $REPO -b master -p $REF -c config.xml -l project.properties
groovy diff.groovy -r $REPO -b master -p $REF -c diff_config.xml -l project.properties
fi
- name: Generate basic single report
if: github.event.comment.body == 'single report'
run: |
cd contribution/checkstyle-tester
bash
REF="origin/${{needs.parse_body.outputs.branch}}"
REPO="../../checkstyle"
groovy diff.groovy -r $REPO -p $REF -pc config.xml -l project.properties -m single
- name: Copy Report to AWS S3 Bucket
run: |
bash
Expand Down

0 comments on commit ba1f9cc

Please sign in to comment.