-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (80 loc) · 2.82 KB
/
tests_documentation.yml
File metadata and controls
88 lines (80 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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: Tests and Docs
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
PDOC_ALLOW_EXEC: 1
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4
with:
submodules: false
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: Install FFmpeg
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: List all available pip updates
run: pip list --outdated
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude custom_models
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude custom_models
- name: Test with pytest
env: # Or as an environment variable
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: pytest -s --ignore custom_models/ --ignore tests/workflow_aws_download_test.py --ignore tests/workflow_zero_shot_od_test.py
- name: Documentation with pdoc
run: pdoc ./*.py ./workflows/*.py ./cloud/*.py ./config/*.py ./tests/*.py ./utils/*.py -o docs
- uses: actions/upload-pages-artifact@v3
with:
path: docs/
# Local availability of docs
- name: Pull request for updated documentation
uses: peter-evans/create-pull-request@v7
with:
base: main
title: '[pdoc] Updated documentation'
commit-message: Update documentation
delete-branch: true
labels: documentation
add-paths: docs/*
# Deploy the artifact to GitHub pages PUBLICLY when pushes to main occur
# https://github.com/mitmproxy/pdoc/blob/main/.github/workflows/docs.yml
deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4