[ci] Update CI jobs to build and check webui

This commit is contained in:
Christian Meffert 2025-01-18 19:21:02 +00:00
parent 89242af3c8
commit 64c85521aa
5 changed files with 21 additions and 41 deletions

View File

@ -1,39 +0,0 @@
name: Build htdocs
on:
push:
branches:
- master
paths:
- 'web-src/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
working-directory: web-src
run: npm install
# Build for production with minification (will update web interface
# in "../htdocs")
- name: Build htdocs
working-directory: web-src
run: npm run build
- name: Count changed files
id: count
run: |
git add htdocs/
git diff --numstat --staged > diffstat
test -s diffstat || { echo "Warning: Push to web-src did not change htdocs"; exit 1; }
# The GH action email is from https://github.com/orgs/community/discussions/26560
- name: Commit and push updated assets
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "[web] Rebuild web interface"
git push

View File

@ -28,7 +28,7 @@ jobs:
uses: vmactions/freebsd-vm@v1
with:
prepare: |
pkg install -y gmake autoconf automake libtool pkgconf gettext gperf glib ffmpeg libconfuse libevent libxml2 libgcrypt libunistring libiconv curl libplist libinotify avahi sqlite3 alsa-lib libsodium json-c libwebsockets protobuf-c bison flex
pkg install -y gmake autoconf automake libtool pkgconf gettext gperf glib ffmpeg libconfuse libevent libxml2 libgcrypt libunistring libiconv curl libplist libinotify avahi sqlite3 alsa-lib libsodium json-c libwebsockets protobuf-c bison flex node npm
pw user add owntone -m -d /usr/local/var/cache/owntone
run: |

View File

@ -36,6 +36,7 @@ jobs:
make
make check
make distcheck
make web-check
- name: Install
run: |

View File

@ -120,6 +120,8 @@ web-update:
$(MAKE) web-update -C web-src
web-serve:
$(MAKE) web-serve -C web-src
web-check:
$(MAKE) web-check -C web-src
web-lint:
$(MAKE) web-lint -C web-src
web-format:

View File

@ -191,8 +191,24 @@ web-serve: node_modules
web-update:
$(if $(NPM),$(NPM) update)
web-check:
@echo "Verifying that all source files in 'src' and 'public' are listed in WEB_FILES ..."
@unexpected_files=0; \
for file in $$(find public src -type f); do \
if ! echo " $(WEB_FILES) " | grep -q " $$file "; then \
echo "Unknown web interface source file found: $$file"; \
unexpected_files=1; \
fi; \
done; \
if [ $$unexpected_files -eq 0 ]; then \
echo "All source files listed in WEB_FILES."; \
else \
echo "FAILURE: Unknown web interface source files found, please add them to WEB_FILES."; \
exit 1; \
fi
web-lint: node_modules
$(if $(NPM),$(NPM) run lint)
$(if $(NPM),$(NPM) run lint --no-fix)
web-format: node_modules
$(if $(NPM),$(NPM) run format)