Skip to content

Update documentation #159

Update documentation

Update documentation #159

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: ConfigILM Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
test:
name: Run tests & display coverage
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11' ]
lightning-version: [ 'full-pytorch_lightning', 'full-lightning' ]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --with dev -E ${{ matrix.lightning-version }}
#----------------------------------------------
# Run test suite + coverage + generate badge
#----------------------------------------------
- name: Run tests + generate coverage
run: |
poetry run coverage run --omit="*/baselines/*" --source=configilm -m pytest
- name: Log latest CI run
run: echo $(date) > latest_ci_run
- name: Generate coverage report
run: |
source .venv/bin/activate
coverage report
coverage json
- name: Generate coverage badge
run: |
source .venv/bin/activate
python generate_readme.py
#----------------------------------------------
# Add Coverage Badge
#----------------------------------------------
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v13
id: verify-changed-files
with:
files: README.md
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add README.md
git status
git remote -v
git commit -m "Updated README.md (CI)"
- name: Push changes
# only push if something changed and only for one python version and one lightning version
# this helps to remove conflicts
if: (steps.verify-changed-files.outputs.files_changed == 'true') && (matrix.python-version == '3.9') && (matrix.lightning-version == 'full-lightning')
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.github_token }}
branch: ${{ github.head_ref }}