From a0b6039dbe1966d29ddd80937b9a790a59ef9cfe Mon Sep 17 00:00:00 2001 From: Evan Gibler Date: Fri, 15 Dec 2023 09:18:24 -0600 Subject: [PATCH] Sync changes from staging repository (#1043) * Add validate Workflow; separate lint and test checks (#1) * Add Workflow to upload on merge to main (#2) * Add Workflow to upload on merge to main * Update job names * Update validate and upload step names (#3) * Update Validate Workflow name * Small tweaks --- .github/workflows/{lint-test.yml => lint.yml} | 7 +--- .github/workflows/test.yml | 27 +++++++++++++ .github/workflows/upload.yml | 39 +++++++++++++++++++ .github/workflows/validate.yml | 36 +++++++++++++++++ 4 files changed, 104 insertions(+), 5 deletions(-) rename .github/workflows/{lint-test.yml => lint.yml} (93%) create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/upload.yml create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint.yml similarity index 93% rename from .github/workflows/lint-test.yml rename to .github/workflows/lint.yml index 215309465..917f2d00f 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint.yml @@ -17,8 +17,8 @@ on: pull_request jobs: - make_lint: - name: lint and test + lint: + name: Lint runs-on: ubuntu-latest steps: @@ -41,6 +41,3 @@ jobs: - name: make lint run: make lint - - - name: make test - run: make test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..2eb871922 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +on: pull_request + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + steps: + - name: Checkout panther-analysis + uses: actions/checkout@v4 + + - name: Set python version + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install pipenv + run: pip install pipenv + + - name: Install + run: make install + + - name: Setup venv + run: make venv + + - name: make test + run: make test diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 000000000..39c829ce5 --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,39 @@ +on: + push: + branches: + - main + +jobs: + upload: + name: + runs-on: ubuntu-latest + env: + API_HOST: ${{ secrets.API_HOST }} + API_TOKEN: ${{ secrets.API_TOKEN }} + steps: + - name: Validate Secrets + if: ${{ env.API_HOST == '' || env.API_TOKEN == '' }} + run: | + echo "API_HOST or API_TOKEN not set" + exit 0 + + - name: Checkout panther-analysis + uses: actions/checkout@v4 + + - name: Set python version + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install pipenv + run: pip install pipenv + + - name: Install + run: make install + + - name: Setup venv + run: make venv + + - name: upload + run: | + pipenv run panther_analysis_tool upload --api-host ${{ env.API_HOST }} --api-token ${{ env.API_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 000000000..189ec23c1 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,36 @@ +on: pull_request + +jobs: + validate: + name: Validate + runs-on: ubuntu-latest + env: + API_HOST: ${{ secrets.API_HOST }} + API_TOKEN: ${{ secrets.API_TOKEN }} + steps: + - name: Validate Secrets + if: ${{ env.API_HOST == '' || env.API_TOKEN == '' }} + run: | + echo "API_HOST or API_TOKEN not set" + exit 0 + + - name: Checkout panther-analysis + uses: actions/checkout@v4 + + - name: Set python version + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install pipenv + run: pip install pipenv + + - name: Install + run: make install + + - name: Setup venv + run: make venv + + - name: validate + run: | + pipenv run panther_analysis_tool validate --api-host ${{ env.API_HOST }} --api-token ${{ env.API_TOKEN }}