Skip to content

Commit

Permalink
Merge pull request #5 from FLEXible-FL/flextrees-aniadir-github-actions
Browse files Browse the repository at this point in the history
Add github actions to the package.
  • Loading branch information
AlArgente authored Oct 24, 2023
2 parents 812c8eb + 8dd83b4 commit bfae911
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pytest.yml
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
27 changes: 27 additions & 0 deletions .github/workflows/trunk.yml
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]
47 changes: 47 additions & 0 deletions .github/workflows/update-coverage.yml
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 }}

0 comments on commit bfae911

Please sign in to comment.