Skip to content

Commit

Permalink
Validate flow to github-actions (#3983)
Browse files Browse the repository at this point in the history
* Validate flow to github-actions

* install node

* git configs

* try normal git clone

* fetch-depth = 0

* fetch-depth 0

* upgrade to node20

* un-comment

* retrigger

* update log path

* use composite action

* checkout

* checkout

* add inputs.
  • Loading branch information
GuyAfik committed Jan 29, 2024
1 parent dad6622 commit 8113e07
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .github/actions/setup_environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ inputs:
type: string
default: "-E generate-unit-tests"
description: "the arguments for the poetry install command"
artifacts-dir:
required: false
type: string
default: $GITHUB_JOB
description: "The name of the artifacts dir"

runs:
using: 'composite'
Expand Down
1 change: 0 additions & 1 deletion .github/actions/setup_test_environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ runs:
uses: ./.github/actions/setup_environment
with:
python-version: ${{ inputs.python-version }}
artifacts-dir: ${{ inputs.artifacts-dir }}

- name: Set up Node.js
uses: actions/setup-node@v3
Expand Down
54 changes: 54 additions & 0 deletions .github/actions/validate/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'Run The Validate Command'
description: 'Run the validate -a command on content master'
author: 'Demisto-SDK'

inputs:
artifacts-path-dir:
required: true
type: string
description: "The path to the artifacts dir"

artifact-name:
required: false
type: string
description: "The name of of the artifact to upload"

validate-script-path:
required: false
type: string
description: "The path to the validate script to run"


runs:
using: 'composite'
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python Environment
uses: ./.github/actions/setup_test_environment
with:
python-version: '3.10'

- name: Checkout content
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: demisto/content
path: content

- name: Run Validate All - Old Validate
run: |
source $(poetry env info --path)/bin/activate
cd content
mkdir -p ${{ inputs.artifacts-path-dir }}/logs
export DEMISTO_SDK_LOG_FILE_PATH=./${{ inputs.artifacts-path-dir }}/logs
./${{ inputs.validate-script-path }}
shell: bash

- name: Upload artifacts
if: always()
uses: ./.github/actions/upload_artifacts
with:
artifacts-path-dir: content/${{ inputs.artifacts-path-dir }}
artifact-name: ${{ inputs.artifact-name }}
39 changes: 36 additions & 3 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ jobs:
with:
python-version: '3.10'

- name: Checkout
- name: Checkout Content
uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down Expand Up @@ -303,7 +303,7 @@ jobs:
- name: run pre-commit on input files
timeout-minutes: 60
continue-on-error: true
continue-on-error: true # TODO - fail if there is an error here
run: |
source $(poetry env info --path)/bin/activate
cd content
Expand All @@ -327,7 +327,6 @@ jobs:
uses: ./.github/actions/setup_environment
with:
python-version: '3.10'
artifacts-dir: test-graph-commands

- name: Checkout content
uses: actions/checkout@v3
Expand Down Expand Up @@ -358,3 +357,37 @@ jobs:
with:
artifacts-path-dir: content/test-graph-commands
artifact-name: test-graph-commands-artifacts

validate-files-old-validate:
runs-on: ubuntu-latest
name: Test Old Validate Command
timeout-minutes: 60
env:
CI_COMMIT_BRANCH: "master"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Run Validate All - New Validate
uses: ./.github/actions/validate
with:
artifacts-path-dir: test-old-validate-command
artifact-name: test-old-validate-command-artifacts
validate-script-path: Tests/scripts/validate.sh

validate-files-new-validate:
runs-on: ubuntu-latest
name: Test New Validate Command
timeout-minutes: 60
env:
CI_COMMIT_BRANCH: "master"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Run Validate All - New Validate
uses: ./.github/actions/validate
with:
artifacts-path-dir: test-new-validate-command
artifact-name: test-new-validate-command-artifacts
validate-script-path: Tests/scripts/new_validate.sh

0 comments on commit 8113e07

Please sign in to comment.