Fix TS0043 Cover Controller #1203
Workflow file for this run
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/CD | |
on: | |
push: | |
branches: [main] | |
tags: ["v*"] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
uses: snok/[email protected] | |
with: | |
version: 1.4.0 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: "{project-dir}/.venv" | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: tests-venv-${{ matrix.python-version }}-v1-${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies | |
run: poetry install --only main,test | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Testing | |
run: poetry run pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=apps --cov-report=xml --cov-report=html | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
pre-commit: | |
name: pre-commit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install pre-commit | |
run: pip install pre-commit | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run pre-commit | |
run: pre-commit run --all-files --show-diff-on-failure | |
hacs: | |
name: HACS validation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: hacs/action@main | |
with: | |
category: appdaemon | |
docs: | |
name: Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install poetry | |
uses: snok/[email protected] | |
with: | |
version: 1.4.0 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: "{project-dir}/.venv" | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: docs-venv-${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies | |
run: poetry install --only main,docs | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Build docs | |
run: cd docs && poetry run mkdocs build | |
- uses: actions/upload-artifact@master | |
with: | |
name: built-docs | |
path: docs/site | |
publish_preview_docs: | |
name: Publish preview documentation | |
runs-on: ubuntu-latest | |
needs: [test, pre-commit, hacs, docs] | |
if: github.ref_type != 'tag' | |
steps: | |
- uses: actions/download-artifact@master | |
with: | |
name: built-docs | |
path: docs/site | |
- name: Move docs to controllerx/ folder | |
run: mkdir docs/controllerx-site && mv docs/site docs/controllerx-site/controllerx | |
- name: Create redirect for /controllerx | |
run: echo "/ /controllerx" > ./docs/controllerx-site/_redirects | |
- name: Deploy to Netlify | |
id: netlify | |
uses: nwtgck/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
publish-dir: "./docs/controllerx-site" | |
deploy-message: "${{ github.event.pull_request.number }} - ${{ github.event.pull_request.title }}" | |
production-deploy: ${{ github.ref_type == 'branch' && github.ref_name == 'main' }} | |
enable-pull-request-comment: true | |
enable-commit-comment: false | |
overwrites-pull-request-comment: true | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
deploy: | |
name: Deployment | |
runs-on: ubuntu-latest | |
needs: [test, pre-commit, hacs, docs] | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Archive Release | |
uses: thedoctor0/zip-release@master | |
with: | |
type: zip | |
filename: ../../controllerx.zip | |
directory: apps/controllerx | |
- run: sed -i 's/VERSION_TAG/${{ github.ref_name }}/g' RELEASE_NOTES.md | |
- run: "sed -i 's/BASE_URL/controllerx.netlify.app/g' RELEASE_NOTES.md" | |
if: contains(github.ref_name, 'b') | |
- run: sed -i 's/BASE_URL/xaviml.github.io/g' RELEASE_NOTES.md | |
if: "!contains(github.ref_name, 'b')" | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: controllerx.zip | |
prerelease: ${{ contains(github.ref_name, 'b') }} | |
bodyFile: RELEASE_NOTES.md | |
generateReleaseNotes: false | |
post_deploy: | |
name: Post deployment | |
runs-on: ubuntu-latest | |
needs: [deploy] | |
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, 'b') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- run: mv RELEASE_NOTES.md RELEASE_NOTES.old.md | |
- run: cp .github/RELEASE_NOTES.template.md RELEASE_NOTES.md | |
- name: Commit report | |
if: hashFiles('RELEASE_NOTES.old.md') != hashFiles('RELEASE_NOTES.md') | |
run: | | |
git config --global user.name 'xaviml' | |
git config --global user.email '[email protected]' | |
git add RELEASE_NOTES.md | |
git commit -m "Upload RELEASE_NOTES.md" | |
git push origin HEAD | |
publish_doc: | |
name: Publish documentation | |
runs-on: ubuntu-latest | |
needs: [deploy] | |
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, 'b') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install poetry | |
uses: snok/[email protected] | |
with: | |
version: 1.4.0 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: "{project-dir}/.venv" | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: docs-venv-${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies | |
run: poetry install --only main,docs | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Publish docs | |
run: cd docs && poetry run mkdocs gh-deploy --force |