91 lines
2.4 KiB
YAML
91 lines
2.4 KiB
YAML
name: Test
|
|
env:
|
|
MONITORED_FILES: "apparmor.txt build.yaml config.yaml Dockerfile data rootfs"
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branch: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
jobs:
|
|
python:
|
|
name: "Python Tests"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
action: [lint, coverage, security-checks]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: 3.9
|
|
- name: Install Dependencies
|
|
run: cd api && make setup
|
|
- name: Echo dependencies
|
|
run: cd api && ./venv/bin/pip freeze
|
|
- name: Running ${{ matrix.action }}
|
|
run: cd api && make ${{ matrix.action }}
|
|
|
|
nodejs:
|
|
name: "NodeJs Tests"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
action:
|
|
- "test:ci"
|
|
- "tsc:ci"
|
|
- "build"
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: "yarn"
|
|
cache-dependency-path: webapp/yarn.lock
|
|
- name: Install Dependencies
|
|
run: cd webapp && yarn install
|
|
- name: Run Tests
|
|
run: cd webapp && yarn ${{ matrix.action }}
|
|
|
|
metadata:
|
|
runs-on: ubuntu-latest
|
|
name: Metadata
|
|
outputs:
|
|
version: ${{ steps.get_version.outputs.VERSION }}
|
|
steps:
|
|
- name: Get the version
|
|
id: version
|
|
shell: "bash"
|
|
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)-g$(echo ${{ github.sha }} | cut -c1-3)
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
name: Build & Publish ${{ matrix.arch }}
|
|
needs:
|
|
- metadata
|
|
- nodejs
|
|
- python
|
|
strategy:
|
|
matrix:
|
|
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2.0.0
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build & Push to Dockerhub - ${{ matrix.arch }} / ${{ needs.metadata.outputs.version }}
|
|
uses: home-assistant/builder@2022.03.1
|
|
with:
|
|
args: |
|
|
--${{ matrix.arch }} \
|
|
--version ${{ needs.metadata.outputs.version }} \
|
|
--additional-tag edge \
|
|
--target .
|