Reapply "Add rules for pytorch config best practices" #159
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: semgrep-rules-test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
semgrep-rules-test: | |
name: run semgrep rules tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: installation | |
run: | | |
python -m pip install --upgrade pip | |
python3 -m pip install semgrep | |
python3 -m pip install jsonschema pyyaml | |
- name: validations | |
run: | | |
config_args=$( | |
for dir in $( | |
find . -type d -maxdepth 1 -mindepth 1 -not -path '*/.*' | |
); | |
do | |
echo -n " --config $dir"; | |
done | |
) | |
echo "Semgrep config arguments: $config_args" | |
semgrep scan --validate $config_args | |
- name: tests | |
run: semgrep --test --test-ignore-todo | |
- name: metadata-tests | |
run: | | |
wget https://raw.githubusercontent.com/returntocorp/semgrep-rules/c5ad4bb0f4c7ee5b8cd47276b582e8bb57bd0a4d/.github/scripts/validate-metadata.py | |
wget https://raw.githubusercontent.com/returntocorp/semgrep-rules/develop/metadata-schema.yaml.schm | |
python ./validate-metadata.py -s ./metadata-schema.yaml.schm -f . | |
- name: rules-tests | |
run: semgrep scan --config="r/yaml.semgrep" --severity ERROR . |