Validate only submitted Project Euler solution (#3977)

* Update validate solution script to fetch only submitted solution
* Update workflow file with the updated PE script
* Fix: do not fetch `validate_solutions.py` script
* Update script to use the requests package for API calls
* Fix: install requests module
* Pytest ignore scripts/ directory
This commit is contained in:
Dhruv Manilawala
2020-11-29 23:11:09 +05:30
committed by GitHub
parent 25164bb638
commit ba6310b647
3 changed files with 55 additions and 10 deletions

View File

@ -22,6 +22,6 @@ jobs:
python -m pip install --upgrade pip setuptools six wheel
python -m pip install pytest-cov -r requirements.txt
- name: Run tests
run: pytest --doctest-modules --ignore=project_euler/ --cov-report=term-missing:skip-covered --cov=. .
run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/ --cov-report=term-missing:skip-covered --cov=. .
- if: ${{ success() }}
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

View File

@ -1,12 +1,14 @@
on:
pull_request:
# only check if a file is changed within the project_euler directory and related files
# Run only if a file is changed within the project_euler directory and related files
paths:
- 'project_euler/**'
- '.github/workflows/project_euler.yml'
- 'scripts/validate_solutions.py'
- "project_euler/**"
- ".github/workflows/project_euler.yml"
- "scripts/validate_solutions.py"
schedule:
- cron: "0 0 * * *" # Run everyday
name: 'Project Euler'
name: "Project Euler"
jobs:
project-euler:
@ -24,8 +26,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install pytest
- name: Install pytest and requests
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pytest
python -m pip install --upgrade pytest requests
- run: pytest scripts/validate_solutions.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}