Merge pull request #8 from FLEXible-FL/revert-7-flexnlp-update-readme #13
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
# This workflow will install dependencies, create coverage tests and run Pytest Coverage Comment | |
# For more information see: https://github.com/MishaKav/pytest-coverage-comment/ | |
name: Update README | |
on: | |
push: | |
branches: [ 'main' ] | |
jobs: | |
build: | |
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: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest pytest-cov | |
pip install . | |
- name: Build coverage file | |
run: | | |
pytest --cov-report=term-missing:skip-covered --cov=flex tests/ | tee pytest-coverage.txt | |
- name: Pytest coverage comment | |
if: ${{ github.ref == 'refs/heads/main' }} | |
id: coverageComment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
hide-comment: true | |
pytest-coverage-path: ./pytest-coverage.txt | |
- name: Update Readme with Coverage Html | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.coverageComment.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./README.md | |
- name: Commit & Push changes to Readme | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: actions-js/push@master | |
with: | |
message: Update coverage on Readme | |
github_token: ${{ secrets.CI_GITHUB_TOKEN }} |