Sync dev branch with the main branch #1062
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Monitoring Stability and Comparing Results | |
# Triggers when a pull_request is triggered | |
on: | |
pull_request_target: | |
branches: | |
- "**" | |
jobs: | |
setup_and_scan: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install JDK-18 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '18' | |
- name: Export Java Home Path | |
run: export PATH=$JAVA_HOME/bin:$PATH | |
- name: Install sbt | |
run: mkdir -p ~/bin && curl -Ls https://raw.githubusercontent.com/dwijnand/sbt-extras/master/sbt > ~/bin/sbt && chmod 0755 ~/bin/sbt | |
- name: Install Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Clone standalone-monitoring-stability/main | |
uses: actions/checkout@v3 | |
with: | |
repository: Privado-Inc/standalone-monitoring-stability | |
path: ./temp/standalone-monitoring-stability | |
ref: main | |
- name: Run the script for ${{github.head_ref}} and ${{github.base_ref}} | |
run: cd ./temp/standalone-monitoring-stability && pip install -r requirements.txt && python3 ./run.py -b ${{github.base_ref}} -h ${{github.head_ref}} -bcr ${{ github.event.pull_request.base.repo.html_url }} -hcr ${{ github.event.pull_request.head.repo.html_url }} -guf | |
- name: Run aws-export | |
run: cd ./temp/standalone-monitoring-stability/ && python3 aws-export.py ${{github.event.number}} | |
- name: Move results to a folder | |
run: cd ./temp/standalone-monitoring-stability/ && mkdir results && mv output-${{github.event.number}}.xlsx ./results/output-${{github.event.number}}.xlsx && mv ./temp/result-${{github.event.number}}.zip ./results/result-${{github.event.number}}.zip && mv slack_summary.txt ./results/slack_summary.txt | |
- name: Upload output and result for next job | |
uses: actions/upload-artifact@master | |
with: | |
name: results | |
path: /home/runner/work/privado-core/privado-core/temp/standalone-monitoring-stability/results | |
send-result-to-slack: | |
needs: setup_and_scan | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download result folder | |
uses: actions/download-artifact@master | |
with: | |
name: results | |
path: ./results | |
- name: Zip the results | |
run: zip result-${{github.event.number}}.zip -r ./results | |
- name: Set summary variable | |
run: | | |
echo "MESSAGE<<EOF" >> $GITHUB_ENV | |
echo "$(cat ./results/slack_summary.txt)" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Post results to slack | |
uses: MeilCli/slack-upload-file@v3 | |
with: | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
channel_id: ${{ secrets.SLACK_CHANNEL_ID }} | |
file_path: "/home/runner/work/privado-core/privado-core/result-${{github.event.number}}.zip" | |
initial_comment: "Comparison Results generated on ${{github.event.repository.name}} by PR ${{github.event.number}} from branch ${{github.head_ref}} to ${{github.base_ref}} \nPR link https://github.com/Privado-Inc/privado-core/pull/${{github.event.number}} \nSummary Report:\n ${{ env.MESSAGE }}" | |
file_type: "zip" | |
send-result-to-workflow: | |
needs: send-result-to-slack | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Download result folder | |
uses: actions/download-artifact@master | |
with: | |
name: results | |
path: ./results | |
- name: Clone standalone-monitoring-stability/main | |
uses: actions/checkout@v3 | |
with: | |
repository: Privado-Inc/standalone-monitoring-stability | |
path: ./temp/standalone-monitoring-stability | |
ref: main | |
- name: Export workflow output | |
run: cd ./temp/standalone-monitoring-stability && python3 ./workflow_check.py /home/runner/work/privado-core/privado-core/results/slack_summary.txt | |
- name: Set summary variable | |
run: | | |
echo "MESSAGE<<EOF" >> $GITHUB_ENV | |
echo "$(cat ./temp/standalone-monitoring-stability/action_result.txt)" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Print action result | |
run: cat ./temp/standalone-monitoring-stability/action_result.txt | |
- name: Workflow report analysis | |
if: ${{ env.MESSAGE != 'true' }} | |
run: exit 1 |