This commit is contained in:
1 parent
ec75ac15b0
commit
7cae29f799
3 files changed
+40
-22
No files matched your search
@@ -27,6 +27,11 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
fail() {
|
||||
printf '::error::%s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
printf 'Runner account: %s\nDeployment directory: %s\n' "$(id -un)" "$DEPLOY_PATH"
|
||||
command -v python3
|
||||
command -v rsync
|
||||
command -v sudo
|
||||
@@ -34,8 +39,9 @@ jobs:
|
||||
command -v flock
|
||||
command -v curl
|
||||
python3 -c 'import sys, tomllib; assert sys.version_info >= (3, 11)'
|
||||
test -d "$DEPLOY_PATH"
|
||||
test -w "$DEPLOY_PATH"
|
||||
test -d "$DEPLOY_PATH" || fail "Deployment directory does not exist: $DEPLOY_PATH"
|
||||
test -w "$DEPLOY_PATH" || fail "Deployment directory is not writable by $(id -un): $DEPLOY_PATH"
|
||||
test -r "$DEPLOY_PATH/config.toml" || fail "Config is missing or unreadable by $(id -un): $DEPLOY_PATH/config.toml. Deployment preserves this file; configure it on the Pi."
|
||||
python3 - <<'PY'
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -44,12 +50,9 @@ jobs:
|
||||
if checkout == deployment or checkout in deployment.parents or deployment in checkout.parents:
|
||||
raise SystemExit('The runner checkout and deployment directory must not overlap')
|
||||
PY
|
||||
test -r /etc/solar-relay/config.toml
|
||||
cmp deploy/solar-relay.service /etc/systemd/system/solar-relay.service || {
|
||||
echo 'Install the updated deploy/solar-relay.service and run systemctl daemon-reload first.'
|
||||
exit 1
|
||||
}
|
||||
sudo -n -l "$(command -v systemctl)" restart "$SERVICE" >/dev/null
|
||||
test -r /etc/systemd/system/solar-relay.service || fail "Collector service unit is missing. Install deploy/solar-relay.service as /etc/systemd/system/solar-relay.service and run systemctl daemon-reload once."
|
||||
cmp deploy/solar-relay.service /etc/systemd/system/solar-relay.service || fail "Installed collector unit differs from deploy/solar-relay.service. Install the updated unit and run systemctl daemon-reload."
|
||||
sudo -n -l "$(command -v systemctl)" restart "$SERVICE" >/dev/null || fail "$(id -un) needs passwordless sudo for $(command -v systemctl) restart $SERVICE."
|
||||
|
||||
- name: Create isolated test environment
|
||||
run: |
|
||||
|
||||
Reference in new issue
Block a user