-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from FLEXible-FL/flextrees-aniadir-github-actions
Add github actions to the package.
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 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: Tests | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: [synchronize, opened] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.8.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8.10 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest pytest-cov | ||
pip install ".[develop]" | ||
- name: Build coverage file | ||
run: | | ||
pytest -n 2 --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=flex tests/ | tee pytest-coverage.txt | ||
- name: Pytest coverage comment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
report-only-changed-files: false | ||
pytest-coverage-path: ./pytest-coverage.txt | ||
junitxml-path: ./pytest.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: Linter | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
types: [synchronize, opened] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Trunk Check | ||
uses: trunk-io/[email protected] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# 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 }} |