forked from mirrors/thatmattlove-hyperglass
github actions ci additions [skip ci]
This commit is contained in:
parent
925a9ad334
commit
a4f041469a
4 changed files with 111 additions and 23 deletions
34
.github/workflows/backend.yml
vendored
34
.github/workflows/backend.yml
vendored
|
|
@ -6,22 +6,42 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: [3.6, 3.8]
|
||||
node-version: [14.x]
|
||||
redis-version: [5, 6]
|
||||
poetry-version: [1.1.4]
|
||||
python-version: [3.6, 3.8]
|
||||
os: [ubuntu-20.04]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
- name: Git Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Run image
|
||||
|
||||
- name: Install Poetry
|
||||
uses: abatilo/actions-poetry@v2.0.0
|
||||
with:
|
||||
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
|
||||
- name: Flake8
|
||||
|
||||
- name: Run Flake8
|
||||
run: poetry run flake8 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)
|
||||
|
||||
|
||||
def install_systemd(app_path):
|
||||
"""Installs generated systemd file to system's systemd directory.
|
||||
def install_systemd(app_path: Path) -> bool:
|
||||
"""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"
|
||||
systemd = Path("/etc/systemd/system")
|
||||
installed = systemd / "hyperglass.service"
|
||||
|
|
@ -403,12 +393,16 @@ def install_systemd(app_path):
|
|||
if not systemd.exists():
|
||||
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():
|
||||
error("Unable to symlink {s} to {d}", s=service, d=installed)
|
||||
except PermissionError:
|
||||
warning("Permission denied to {f}. Systemd service not installed.", f=installed)
|
||||
|
||||
success("Symlinked {s} to {d}", s=service, d=installed)
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue