mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
github actions ci additions [skip ci]
This commit is contained in:
34
.github/workflows/backend.yml
vendored
34
.github/workflows/backend.yml
vendored
@@ -6,22 +6,42 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.6, 3.8]
|
node-version: [14.x]
|
||||||
|
redis-version: [5, 6]
|
||||||
poetry-version: [1.1.4]
|
poetry-version: [1.1.4]
|
||||||
|
python-version: [3.6, 3.8]
|
||||||
os: [ubuntu-20.04]
|
os: [ubuntu-20.04]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Git Checkout
|
||||||
- uses: actions/setup-python@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Run image
|
|
||||||
|
- name: Install Poetry
|
||||||
uses: abatilo/actions-poetry@v2.0.0
|
uses: abatilo/actions-poetry@v2.0.0
|
||||||
with:
|
with:
|
||||||
poetry-version: ${{ matrix.poetry-version }}
|
poetry-version: ${{ matrix.poetry-version }}
|
||||||
- name: Install Dependencies
|
|
||||||
|
- name: Install Node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Start Redis
|
||||||
|
uses: supercharge/redis-github-action@1.1.0
|
||||||
|
with:
|
||||||
|
redis-version: ${{ matrix.redis-version }}
|
||||||
|
|
||||||
|
- name: Install Python Dependencies
|
||||||
run: poetry install
|
run: poetry install
|
||||||
- name: Flake8
|
|
||||||
|
- name: Run Flake8
|
||||||
run: poetry run flake8 hyperglass
|
run: poetry run flake8 hyperglass
|
||||||
|
|
||||||
- name: Run hyperglass
|
- name: Run hyperglass
|
||||||
run: '.tests/app/setup.sh'
|
run: '.tests/ga-backend-app.sh'
|
||||||
|
26
.github/workflows/frontend.yml
vendored
Normal file
26
.github/workflows/frontend.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Frontend Testing
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
frontend:
|
||||||
|
name: Type Check
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node-version: [14.x]
|
||||||
|
os: [ubuntu-20.04]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Git Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: yarn install
|
||||||
|
|
||||||
|
- name: TypeScript Check
|
||||||
|
uses: icrawl/action-tsc@v1
|
48
.tests/ga-backend-app.sh
Executable file
48
.tests/ga-backend-app.sh
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "[INFO] Starting setup..."
|
||||||
|
poetry run hyperglass setup -d
|
||||||
|
echo "[SUCCESS] Setup completed."
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "[INFO] Setting listen_address..."
|
||||||
|
echo "listen_address: 127.0.0.1" >> $HOME/hyperglass/hyperglass.yaml
|
||||||
|
|
||||||
|
echo "[INFO] Starting UI build."
|
||||||
|
poetry run hyperglass build-ui
|
||||||
|
|
||||||
|
if [[ ! $? == 0 ]]; then
|
||||||
|
echo "[ERROR] Failed to start hyperglass."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[SUCCESS] UI build completed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[INFO] Starting hyperglass..."
|
||||||
|
poetry run hyperglass start &> $HOME/hyperglass-ci.log &
|
||||||
|
sleep 180
|
||||||
|
|
||||||
|
if [[ ! $? == 0 ]]; then
|
||||||
|
echo "[ERROR] Failed to start hyperglass."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[SUCCESS] Started hyperglass."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[INFO] Running HTTP test..."
|
||||||
|
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8001)
|
||||||
|
|
||||||
|
echo "[INFO] Status code: $STATUS"
|
||||||
|
|
||||||
|
if [[ ! $? == 0 ]]; then
|
||||||
|
echo "[ERROR] HTTP test failed."
|
||||||
|
exit 1
|
||||||
|
elif [[ ! "$STATUS" == "200" ]]; then
|
||||||
|
echo "[ERROR] HTTP test failed. Startup log:"
|
||||||
|
cat /var/log/hyperglassci.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[SUCCESS] Tests ran successfully."
|
||||||
|
exit 0
|
@@ -383,19 +383,9 @@ def migrate_static_assets(app_path):
|
|||||||
callback(msg, a=a, b=b)
|
callback(msg, a=a, b=b)
|
||||||
|
|
||||||
|
|
||||||
def install_systemd(app_path):
|
def install_systemd(app_path: Path) -> bool:
|
||||||
"""Installs generated systemd file to system's systemd directory.
|
"""Installs generated systemd file to system's systemd directory."""
|
||||||
|
|
||||||
Arguments:
|
|
||||||
app_path {Path} -- hyperglass runtime path
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
ClickException: Raised if the /etc/systemd/system does not exist
|
|
||||||
ClickException: Raised if the symlinked file does not exit
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
{bool} -- True if successful
|
|
||||||
"""
|
|
||||||
service = app_path / "hyperglass.service"
|
service = app_path / "hyperglass.service"
|
||||||
systemd = Path("/etc/systemd/system")
|
systemd = Path("/etc/systemd/system")
|
||||||
installed = systemd / "hyperglass.service"
|
installed = systemd / "hyperglass.service"
|
||||||
@@ -403,12 +393,16 @@ def install_systemd(app_path):
|
|||||||
if not systemd.exists():
|
if not systemd.exists():
|
||||||
error("{e} does not exist. Unable to install systemd service.", e=systemd)
|
error("{e} does not exist. Unable to install systemd service.", e=systemd)
|
||||||
|
|
||||||
installed.symlink_to(service)
|
try:
|
||||||
|
installed.symlink_to(service)
|
||||||
|
if not installed.exists():
|
||||||
|
warning("Unable to symlink {s} to {d}", s=service, d=installed)
|
||||||
|
else:
|
||||||
|
success("Symlinked {s} to {d}", s=service, d=installed)
|
||||||
|
|
||||||
if not installed.exists():
|
except PermissionError:
|
||||||
error("Unable to symlink {s} to {d}", s=service, d=installed)
|
warning("Permission denied to {f}. Systemd service not installed.", f=installed)
|
||||||
|
|
||||||
success("Symlinked {s} to {d}", s=service, d=installed)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user