feat: project structure was updated. #61
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: Recommendation Engine CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout code" | |
uses: "actions/checkout@v2" | |
- name: "Setup Python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: "Install Poetry" | |
run: | | |
pip install pkginfo virtualenv poetry | |
# - name: "Install poetry" | |
# run: | | |
# curl -sSL https://install.python-poetry.org | python3 - | |
- name: Install dependencies | |
run: | | |
poetry install --no-root --no-dev -vvv | |
- name: Poetry virtualenv configuration | |
run: | | |
poetry config virtualenvs.in-project true | |
- name: Run main.py | |
run: | | |
timeout 5s poetry run python main.py || true | |
- name: Run tests and coverage report | |
run: | | |
poetry run coverage run --data-file .coverage -m pytest -s | |
poetry run coverage json | |
- name: Set total coverage to COVERAGE_REPORT environment variable | |
run: | | |
export COVERAGE_REPORT=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered'])") | |
echo "##TOTAL COVERAGE: ${COVERAGE_REPORT}" | |
COVERAGE_RESULT=$(echo "$COVERAGE_REPORT < 60" | bc) | |
if [ "$COVERAGE_RESULT" -eq 1 ]; then | |
echo "Coverage less than 60%. Exiting..." | |
exit 1 | |
fi | |