Skip to content

Commit

Permalink
ci: ci work
Browse files Browse the repository at this point in the history
Signed-off-by: Tomer Figenblat <[email protected]>
  • Loading branch information
TomerFi committed Dec 26, 2024
1 parent ef383ce commit 7755235
Show file tree
Hide file tree
Showing 15 changed files with 299 additions and 250 deletions.
9 changes: 8 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body:
attributes:
label: Module Version
description: What version of `aioswitcher` are you using?
placeholder: ex. 2.0.2
placeholder: ex. 5.1.1
validations:
required: true

Expand All @@ -39,6 +39,13 @@ body:
- Switcher Breeze
- Switcher Runner
- Switcher Runner Mini
- Switcher Runner S11
- Switcher Runner S12
- Switcher Light SL01
- Switcher Light SL01 Mini
- Switcher Light SL02
- Switcher Light SL02 Mini
- Switcher Light SL03
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ blank_issues_enabled: false
contact_links:
- name: GitHub Discussions
url: https://github.com/TomerFi/aioswitcher/discussions/
about: You can also use Discussions for questions and ideas.
about: Use Discussions for questions and ideas.
2 changes: 1 addition & 1 deletion .github/auto-me-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ pr:
conventionalTitle:
tasksList:
autoApprove:
users: ['dependabot', 'allcontributors']
users: ['dependabot']
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
version: 2
updates:
- package-ecosystem: github-actions
directory: /.github/workflows
schedule:
interval: weekly
labels:
- "type: dependencies"
commit-message:
prefix: "ci"
include: "scope"
assignees:
- "tomerfi"
- "thecode"
- "YogevBokobza"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: daily
labels:
- "type: dependencies"
commit-message:
prefix: "build"
include: "scope"
assignees:
- "tomerfi"
- "thecode"
- "YogevBokobza"
16 changes: 0 additions & 16 deletions .github/stale.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/on_call/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: Build docs

on:
workflow_call:
inputs:
python_version:
required: true
type: string
description: Python version to run with
checkout_ref:
required: true
type: string
description: Checkout reference
deploy-pages:
required: false
default: false
type: boolean
description: Deploy to GH-pages
secrets:
github_token:
required: false
description: GitHub token required if inputs.deploy-pages is true

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Source checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Cache pip repository
uses: actions/cache@v4
with:
path: ~/.cache/pip
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ inputs.python_version }}

- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v4
with:
path: .venv
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-poetry-docs-${{ hashFiles('**/pyproject.toml') }}-${{ inputs.python_version }}

- name: Build documentation site
run: |
poetry install --no-interaction --no-update --without dev
poetry run poe docs_build
- name: Deploy to GH-Pages
if: ${{ inputs.deploy-pages }}
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.github_token }}
publish_dir: ./site
cname: aioswitcher.tomfi.info
commit_message: 'docs: deployed documentation site '
85 changes: 85 additions & 0 deletions .github/workflows/on_call/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: Test project

on:
workflow_call:
inputs:
python_version:
required: true
type: string
description: Python version to run with
push_coverage:
required: false
default: true
type: boolean
description: Create and push coverage report
report_tests:
required: false
default: false
type: boolean
description: Report test summary
secrets:
codecov_token:
required: false
description: Codecov token required if inputs.push_coverage is true

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Source checkout
uses: actions/checkout@v4

- name: Setup timezone
uses: zcong1993/[email protected]
with:
timezone: Asia/Jerusalem

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Cache pip repository
uses: actions/cache@v4
with:
path: ~/.cache/pip
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ inputs.python_version }}

- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v4
with:
path: .venv
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-poetry-test-${{ hashFiles('**/pyproject.toml') }}-${{ inputs.python_version }}

- name: Install project build dependencies
run: poetry install --no-interaction --no-update

- name: Test the project
run: >
if [ ${{ inputs.push_coverage }} ];
then poetry run poe test_rep;
else poetry run poe test; fi
- name: Report test summary
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ inputs.report_tests && always() }}
with:
test_changes_limit: 0
junit_files: ./junit.xml
report_individual_runs: true

- name: Push to CodeCov
uses: codecov/codecov-action@v5
if: ${{ inputs.push_coverage }}
with:
token: ${{ secrets.codecov_token }}
files: ./coverage.xml
54 changes: 11 additions & 43 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,20 @@
name: Pages Deploy

on:
workflow_dispatch:
release:
types: [published]

env:
MAIN_PY_VER: "3.10"

jobs:
deploy-pages:
runs-on: ubuntu-latest
environment: github-pages
name: Build documentation site and deploy to GH-Pages
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Cache pip repository
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }}

- name: Build documentation site
run: |
poetry install --no-interaction --without dev
poetry run poe docs_build
- name: Deploy to GH-Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
cname: aioswitcher.tomfi.info
commit_message: 'docs: deployed documentation site '
uses: ./.github/workflows/on_call/docs.yml
with:
python_version: ${{ env.MAIN_PY_VER }}
checkout_ref: ${{ github.ref }}
deploy-pages: true
secrets:
github_token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 7755235

Please sign in to comment.