Update README.md #42
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
name: CI Workflow | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
- 'releases/*' | |
jobs: | |
sanity-tests: | |
name: Sanity Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install -r requirements.txt | |
- name: Run sanity tests | |
id: sanity | |
env: | |
PYTHONPATH: ${{ github.workspace }} # Add workspace to PYTHONPATH | |
run: | | |
result=$(.venv/bin/pytest -v --tb=short resources/tests/sanity_tests.py) | |
echo "result<<EOF" >> $GITHUB_ENV | |
echo "$result" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
return-tests: | |
name: Return Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install -r requirements.txt | |
- name: Run remaining return tests | |
id: return | |
env: | |
PYTHONPATH: ${{ github.workspace }} # Add workspace to PYTHONPATH | |
run: | | |
result=$(.venv/bin/pytest -v --tb=short resources/tests/return_tests.py) | |
echo "result<<EOF" >> $GITHUB_ENV | |
echo "$result" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
variable-naming-tests: | |
name: Variable Case Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install -r requirements.txt | |
- name: Run variable naming convention tests | |
id: variable_naming | |
env: | |
PYTHONPATH: ${{ github.workspace }} # Add workspace to PYTHONPATH | |
run: | | |
result=$(.venv/bin/pytest -v --tb=short resources/tests/variable_cases.py) | |
echo "result<<EOF" >> $GITHUB_ENV | |
echo "$result" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
generate-pydoc: | |
runs-on: ubuntu-latest | |
name: Generate PyDoc Documentation | |
if: github.event_name != 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository # Exclude from PRs and forks | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install -r requirements.txt | |
- name: Create PyDoc documentation | |
run: | | |
mkdir -p docs | |
find src -name "*.py" | while read filepath; do | |
relative_path=$(dirname "$filepath" | sed 's|src/||') | |
mkdir -p "docs/$relative_path" | |
.venv/bin/python -m pydoc -w "$filepath" | |
filename=$(basename "$filepath" .py).html | |
mv "$filename" "docs/$relative_path/" | |
done | |
- name: Commit Docs | |
env: | |
GITHUB_TOKEN: ${{ secrets.DOCS_REPO_ACCESS_TOKEN }} | |
run: | | |
git config --global user.email "matthewspratlin@gmail.com" | |
git config --global user.name "Matthew Spratlin" | |
git clone https://MKS2345:${{ secrets.DOCS_REPO_ACCESS_TOKEN }}@github.com/MKS2345/BEST_LowG_Docs.git external-repo | |
cp -r docs/* external-repo/docs/ | |
cd external-repo | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Generate PyDoc Documentation - ${{ github.event.head_commit.message }}" | |
git push | |
else | |
echo "No changes to documentation, skipping commit." | |
fi | |
- name: Clean up local docs folder | |
run: rm -rf docs | |
qodana: | |
name: Qodana | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
checks: write | |
if: github.event_name != 'pull_request' # Exclude from pull requests | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
# Run Python inside the Qodana Docker container | |
- name: Qodana Scan | |
uses: JetBrains/qodana-action@v2024.1 | |
with: | |
pr-mode: false | |
env: | |
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_1408482145 }} | |
QODANA_ENDPOINT: 'https://qodana.cloud' | |
summary: | |
name: Summary Report | |
runs-on: ubuntu-latest | |
needs: [sanity-tests, variable-naming-tests, return-tests, generate-pydoc] # Exclude Qodana | |
steps: | |
- name: Sanity Tests Summary | |
id: sanity | |
run: echo "Sanity Tests Passed!" # You can replace this with actual test output | |
continue-on-error: true | |
shell: bash | |
- name: Variable Naming Tests Summary | |
id: variable_naming | |
run: echo "Variable Naming Tests Passed!" # You can replace this with actual test output | |
continue-on-error: true | |
shell: bash | |
- name: Return Tests Summary | |
id: return_tests | |
run: echo "Return Tests Passed!" # You can replace this with actual test output | |
continue-on-error: true | |
shell: bash | |
- name: PyDoc Generation Summary | |
id: pydoc | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "PyDoc Generation not supported in forks." | |
else | |
echo "PyDoc Generation Succeeded!" # Replace with actual PyDoc generation status | |
fi | |
continue-on-error: true | |
shell: bash |