Skip to content

Commit

Permalink
chore: Updated workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed Sep 22, 2024
1 parent 1356626 commit b963cbd
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 91 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/deploy_docs.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docs
on:
workflow_dispatch:
push:
paths:
- 'mkdocs.yml'
- '_docs/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build_docs:
if: ${{ (github.repository_owner == 'BottlecapDave' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main')) == false }}
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: |
_docs
- name: asdf_install
uses: asdf-vm/actions/install@v3
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: mkdocs build --strict

deploy_docs:
if: ${{ github.repository_owner == 'BottlecapDave' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main') }}
name: Deploy docs
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: |
_docs
- name: asdf_install
uses: asdf-vm/actions/install@v3
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: mkdocs gh-deploy --strict --force
4 changes: 2 additions & 2 deletions .github/workflows/inactive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
if: ${{ github.repository_owner == 'BottlecapDave' }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v4
- uses: actions/stale@v9
with:
days-before-issue-stale: 30
days-before-issue-close: 14
Expand Down
55 changes: 39 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,80 @@ on:
schedule:
- cron: '0 1 * * *'
push:
paths-ignore:
- '**.md'
branches:
- develop
- main
paths-ignore:
- 'mkdocs.yml'
- '_docs/**'
pull_request:
workflow_dispatch:
branches-ignore:
- main
paths-ignore:
- 'mkdocs.yml'
- '_docs/**'
jobs:
validate:
if: ${{ github.event_name != 'schedule' || github.repository_owner == 'BottlecapDave' }}
name: Validate
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: actions/checkout@v4
- uses: "home-assistant/actions/hassfest@master"
- name: HACS Action
uses: "hacs/action@main"
with:
ignore: "brands"
category: "integration"
test:
name: Test
unit_tests:
if: ${{ github.event_name != 'schedule' || github.repository_owner == 'BottlecapDave' }}
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: asdf_install
uses: asdf-vm/actions/install@v1
uses: asdf-vm/actions/install@v3
- name: Install Python modules
run: |
pip install -r requirements.test.txt
- name: Unit tests suite
- name: Run unit tests
run: |
python -m pytest tests/unit
- name: Integration tests suite
integration_tests:
# Tests are geared towards my account, so ignore for others
if: ${{ github.repository_owner == 'BottlecapDave' }}
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: asdf_install
uses: asdf-vm/actions/install@v3
- name: Install Python modules
run: |
pip install -r requirements.test.txt
- name: Run integration tests
run: |
python -m pytest tests/integration
release:
name: Release
if: github.ref == 'refs/heads/main'
needs:
if: ${{ github.repository_owner == 'BottlecapDave' && github.ref == 'refs/heads/main' }}
needs:
- validate
- test
- unit_tests
- integration_tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: asdf_install
uses: asdf-vm/actions/install@v1
uses: asdf-vm/actions/install@v3
- name: Install dependencies
run: npm ci
- name: Release
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 16.13.0
python 3.10.1
nodejs 22.4.0
python 3.12.4
63 changes: 23 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Home Assistant integration for interacting with Carbon Intensity",
"main": "index.js",
"scripts": {
"build": "tsc ./.build/*.ts --noEmit",
"commit": "cz",
"release": "semantic-release",
"test-unit": "python -m pytest tests/unit",
Expand All @@ -21,8 +22,8 @@
},
"homepage": "https://github.com/BottlecapDave/HomeAssistant-CarbonIntensity#readme",
"devDependencies": {
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/exec": "^6.0.2",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"commitizen": "^4.2.4",
"conventional-changelog-eslint": "^3.0.9",
Expand Down

0 comments on commit b963cbd

Please sign in to comment.