-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from xaviml/ci/github-actions
ci: add github actions
- Loading branch information
Showing
8 changed files
with
170 additions
and
106 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[![downloads](https://img.shields.io/github/downloads/xaviml/controllerx/VERSION_TAG/total?style=for-the-badge)](http://github.com/xaviml/controllerx/releases/VERSION_TAG) | ||
|
||
<!--:warning: This major/minor change contains a breaking change.--> | ||
|
||
_This minor change does not contain any breaking changes._ | ||
_Note: Remember to restart the AppDaemon addon/server after updating to a new version._ | ||
PRERELEASE_NOTE | ||
|
||
<!-- | ||
## :pencil2: Features | ||
--> | ||
|
||
<!-- | ||
## :hammer: Fixes | ||
--> | ||
|
||
<!-- | ||
## :clock2: Performance | ||
--> | ||
|
||
<!-- | ||
## :scroll: Docs | ||
--> | ||
|
||
<!-- | ||
## :wrench: Refactor | ||
--> | ||
|
||
<!-- | ||
## :video_game: New devices | ||
- [XYZ](https://xaviml.github.io/controllerx/controllers/XYZ) - add device with Z2M support. [ #123 ] | ||
--> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: CI/CD | ||
|
||
on: | ||
push: | ||
branches: [main, dev] | ||
tags: ["v*"] | ||
pull_request: | ||
branches: [main, dev] | ||
|
||
jobs: | ||
test: | ||
name: Styling and Testing | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | ||
- name: Install dependencies | ||
run: poetry install | ||
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@v2 | ||
pre-commit: | ||
name: pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- uses: actions/cache@v3 | ||
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@v3 | ||
- uses: hacs/action@main | ||
with: | ||
category: appdaemon | ||
deploy: | ||
name: Deployment | ||
runs-on: ubuntu-latest | ||
needs: [test, pre-commit, hacs] | ||
if: startsWith(github.ref_name,'v') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- 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/PRERELEASE_NOTE/_Note: Some links might not work or might be not updated due to being a pre-release, and documentation is not yet available_/g' RELEASE_NOTES.md" | ||
if: contains(github.ref_name, 'b') | ||
- run: sed -i 's/PRERELEASE_NOTE//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: true | ||
post_deploy: | ||
name: Post deployment | ||
runs-on: ubuntu-latest | ||
needs: [deploy] | ||
if: startsWith(github.ref_name,'v') && !contains(github.ref_name, 'b') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
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 'xaviml@users.noreply.github.com' | ||
git add RELEASE_NOTES.md | ||
git commit -m "Upload RELEASE_NOTES.md" | ||
git push origin HEAD | ||
- name: Merge main -> dev | ||
if: hashFiles('RELEASE_NOTES.old.md') != hashFiles('RELEASE_NOTES.md') | ||
uses: devmasx/merge-branch@master | ||
with: | ||
type: now | ||
from_branch: main | ||
target_branch: dev | ||
github_token: ${{ github.token }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
name: Validate | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
validate: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
- uses: actions/checkout@v3 | ||
- name: HACS validation | ||
uses: "hacs/action@main" | ||
uses: hacs/action@main | ||
with: | ||
category: "appdaemon" | ||
category: appdaemon |
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
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
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
This file was deleted.
Oops, something went wrong.