Skip to content

Update main.yml

Update main.yml #78

Workflow file for this run

name: Check commit
on:
push:
branches: ["main"]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
unittest:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyopengl==3.1.6
pip install .[test]
- name: Test with pytest
run: pytest ./test/
coverage:
name: Upload coverage report
needs: unittest
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyopengl==3.1.6
pip install .[test]
- name: Produce coverage report
run: pytest --cov dm_robotics.panda --cov-report xml:coverage.xml ./test/
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
linting:
name: Linting
needs: unittest
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[lint]
- name: Lint with pylint and generate badge
run: |
mkdir ./pylint
pylint --rcfile .pylintrc --output-format=text --exit-zero src/ | tee ./pylint/pylint.log
PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
anybadge --label=Pylint --file=pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
- name: Upload linting artifact (log and badge)
uses: actions/upload-artifact@v4
with:
name: linting-results
path: ./pylint
build-and-prepare-pages:
name: Build documentation and prepare for Pages
runs-on: ubuntu-latest
needs: [unittest, linting]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyopengl==3.1.6
pip install .[doc]
- name: Build with Sphinx
run: cd doc && make html
- name: Download linting results (log and badge)
uses: actions/download-artifact@v4
with:
name: linting-results
path: ./doc/_build/html
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact for GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: ./doc/_build/html
deploy:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-and-prepare-pages
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4