Skip to content

Hackathon Test

Hackathon Test #22

name: v2 App Unit Test
on: [pull_request]
jobs:
v2-app-unit-test:
name: "V2 App Unit Test"
runs-on: "ubuntu-latest"
env:
SUMO_APPS_V2_REPO_PATH: ${{ github.workspace }}
TARGET_BRANCH: "origin/${{ github.event.pull_request.base.ref }}"
SOURCE_BRANCH: "origin/${{ github.event.pull_request.head.ref }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python3 -m pip install -U pip wheel setuptools
- name: "Install sumoappsuite tool"
run: |
pip3 install $GITHUB_WORKSPACE/scripts/sumologic_appdevutils*.whl
- name: "Generate SCR File"
run: |
sumoappsuite generate-scr-file-v2-app && cat scr_app_list.yaml | yq ".apps[0].relativeFolderPath" >> appPath
# - name: "Run Sumo Logic App Tests"
# run: |
# sumoappsuite run-all-app-tests-v2 -f scr_app_list.yaml -e test_tfApp_installable,test_is_deployable,test_sumo_query,test_threatintel_query,test_update_v2_app
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: "us-west-2"
# - name: List objects in S3 bucket #Testing aws cli
# run: aws s3 ls
- name: "Run Sumo Logic App Review tool" #sumoappsuite review-v2-app -f "{SUMO_APPS_V2_REPO_PATH}{appPath}"
run: |
echo "Header1, Header2, Header3" > appreviewoutput.xlsx
echo "Data1, Data2, Data3" >> appreviewoutput.xlsx
echo "${SUMO_APPS_V2_REPO_PATH}${appPath}"
- name: Upload Excel Sheet as PR Comment
uses: actions/upload-artifact@v4
with:
name: excel-sheet
path: appreviewoutput.xlsx
- name: Get Artifact URL
id: get_artifact_url
run: echo "::set-output name=artifact_url::${{ steps.upload_artifact.outputs.artifact_url }}"
- name: Comment on PR with Artifact URL
uses: actions/github-script@5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Excel Sheet artifact URL: ' + '${{ steps.get_artifact_url.outputs.artifact_url }}'
})