CI faster and lighter on the runner; F-SVC-7 without a second config file
CI (owner: speed up, less runner load). Measured per push: go 4–5.5 min (fuzz 1.9), package 2–3.5, e2e 5–7 (145 tests = 29 × 5 browsers, trace for every test); three runs at once on CT 131 slowed WebKit past the 30 s test limit. - concurrency + cancel-in-progress: a newer push replaces the older run. - paths-ignore docs/** and *.md: docs commits run no CI. - e2e per push: Chromium + phone; Firefox, WebKit, wide screen nightly (02:23) and on demand (workflow_dispatch). - Playwright: trace only on retry, one retry in CI (flaky tests show as flaky in the report instead of failing the run). - fuzz: 5 s per target per push, 2 min nightly (Makefile FUZZTIME). - npm cache in the go job. F-SVC-7 (owner agreed): service switches stay in systemd (source of truth); automation uses systemctl, documented in system-requirements.md; the setup wizard gets the switches. No config.yaml for them. Includes the e2e fix from fbeb68f (update check may take up to 60 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a779abc94e
commit
1104081f80
7 files changed
+71
-32
No files matched your search
+28
-9
@@ -1,9 +1,21 @@
|
||||
# Quality gates for every push and pull request.
|
||||
# Quality gates for every push and pull request. Per push: the fast set
|
||||
# (e2e in Chromium + phone, short fuzz). Nightly and on demand: everything
|
||||
# (Firefox, WebKit, wide screen, longer fuzz).
|
||||
name: ci
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore: ['docs/**', '**/*.md']
|
||||
pull_request:
|
||||
paths-ignore: ['docs/**', '**/*.md']
|
||||
schedule:
|
||||
- cron: '23 2 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
# A newer commit replaces the run of an older one on the same branch.
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
go:
|
||||
@@ -16,6 +28,8 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- name: web UI — install, type check, unit tests, build
|
||||
working-directory: web
|
||||
run: |
|
||||
@@ -40,15 +54,15 @@ jobs:
|
||||
mkdir -p dist
|
||||
go run ./cmd/sharestead -openapi > dist/openapi.json
|
||||
cd web && npm run lint:api
|
||||
- name: fuzz (short)
|
||||
run: make fuzz-short
|
||||
- name: fuzz
|
||||
run: make fuzz FUZZTIME=${{ github.event_name == 'push' && '5s' || '2m' }}
|
||||
- name: known vulnerabilities
|
||||
run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...
|
||||
|
||||
package:
|
||||
# dev packages for every push to main → Gitea Debian registry, channel "dev".
|
||||
# Built on Debian 12 so the binaries run on Debian 12, 13 and Raspberry Pi OS.
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
needs: go
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -94,7 +108,7 @@ jobs:
|
||||
|
||||
install-test:
|
||||
# The amd64 package must install and start on every supported Debian release.
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
needs: package
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
@@ -123,9 +137,10 @@ jobs:
|
||||
test "$(curl -sk -o /dev/null -w '%{http_code}' https://127.0.0.1:8443/api/v1/auth/session)" = 401
|
||||
|
||||
e2e:
|
||||
# Browser tests in Chromium, Firefox, WebKit and a mobile viewport against
|
||||
# the real package, with a real PAM login. Screenshots are kept as artifact.
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
# Browser tests against the real package, with a real PAM login. Per push:
|
||||
# Chromium + phone; nightly/on demand: also Firefox, WebKit, wide screen.
|
||||
# Screenshots are kept as artifact.
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
needs: package
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -154,7 +169,11 @@ jobs:
|
||||
SST_USER: e2e-admin
|
||||
run: |
|
||||
npm ci --no-audit --no-fund
|
||||
npx playwright test
|
||||
if [ "${{ github.event_name }}" = push ]; then
|
||||
npx playwright test --project=chromium --project=mobile
|
||||
else
|
||||
npx playwright test
|
||||
fi
|
||||
- name: server log
|
||||
if: always()
|
||||
run: cat /tmp/sharestead.log
|
||||
|
||||
@@ -70,5 +70,8 @@ Passkeys need a host name: start Chromium with `--host-resolver-rules=MAP shares
|
||||
- Early phase: the AI may commit and push to `main` directly; CI must stay green.
|
||||
- **Ask the owner before tagging a release** (first one: 0.1.0).
|
||||
- Commit messages explain what changed and why; one topic per commit.
|
||||
- CI runs per push only the fast set (e2e in Chromium + phone); Firefox, WebKit and the wide
|
||||
screen run nightly and on demand (*Run workflow*). A newer push cancels the older run. Several
|
||||
small commits are fine, but don't push them one by one while CI is busy: push them together.
|
||||
- Several agents may work at once: put larger changes that touch shared files on a branch
|
||||
(or a separate worktree) and open a pull request.
|
||||
@@ -1,5 +1,5 @@
|
||||
# Common development tasks. CI runs the same targets.
|
||||
.PHONY: test fuzz-short fuzz vet fmt
|
||||
.PHONY: test fuzz fuzz-short vet fmt
|
||||
|
||||
test:
|
||||
go test -race -cover ./...
|
||||
@@ -10,12 +10,12 @@ vet:
|
||||
fmt:
|
||||
gofmt -w .
|
||||
|
||||
# Short fuzz run per target (CI, every push)
|
||||
fuzz-short:
|
||||
for p in smbconf nfsconf exports; do for f in FuzzRoundTrip FuzzSetIsReadBack; do \
|
||||
go test ./internal/format/$$p -run '^$$' -fuzz $$f -fuzztime 15s || exit 1; done; done
|
||||
|
||||
# Long fuzz run (nightly)
|
||||
# Fuzz every target for FUZZTIME (CI: 5s per push, 2m nightly).
|
||||
FUZZTIME ?= 15s
|
||||
fuzz:
|
||||
for p in smbconf nfsconf exports; do for f in FuzzRoundTrip FuzzSetIsReadBack; do \
|
||||
go test ./internal/format/$$p -run '^$$' -fuzz $$f -fuzztime 10m || exit 1; done; done
|
||||
go test ./internal/format/$$p -run '^$$' -fuzz $$f -fuzztime $(FUZZTIME) || exit 1; done; done
|
||||
|
||||
# Short run for local use.
|
||||
fuzz-short:
|
||||
$(MAKE) fuzz FUZZTIME=15s
|
||||
@@ -111,7 +111,7 @@ Items marked ❓ depend on an open question in [README](README.md#open-questions
|
||||
| ID | Requirement | Prio | Release |
|
||||
|---|---|---|---|
|
||||
| F-HIS-1 | **One journal for everything:** every change from the UI, the API, the system (e.g. quota enforcement) or made **by hand** in a managed file | M | MVP |
|
||||
| F-HIS-2 | **All managed config files** are watched and versioned: `smb.conf` + includes, `/etc/exports` + `exports.d`, `nfs.conf`, `minidlna.conf`, discovery config, the app's own `config.yaml` (services, quotas, settings) | M | MVP |
|
||||
| F-HIS-2 | **All managed config files** are watched and versioned: `smb.conf` + includes, `/etc/exports` + `exports.d`, `nfs.conf`, `minidlna.conf`, discovery config, the app's own settings (quotas, personal folders, self-service) | M | MVP |
|
||||
| F-HIS-3 | One UI action that touches several things (e.g. *new shared folder*: folder + group + `smb.conf` + `exports`) is **one change set**, shown and reverted as a unit | M | MVP |
|
||||
| F-HIS-4 | **Undo a single change**, also an older one. If later changes touched the same lines, the UI shows the conflict instead of guessing | M | MVP |
|
||||
| F-HIS-5 | **Restore a point in time:** bring one file or all config back to the state of a chosen entry | M | MVP |
|
||||
@@ -151,7 +151,7 @@ Items marked ❓ depend on an open question in [README](README.md#open-questions
|
||||
| F-SVC-4 | **Default after install: only SMB + discovery on.** Everything else is opt-in | M | MVP |
|
||||
| F-SVC-5 | Switched-off protocols disappear from the UI (no per-share toggles, no hints). Share settings for them are kept and come back when switched on again | M | MVP |
|
||||
| F-SVC-6 | Switching off shows the impact first: which shares use it, who is connected right now | M | MVP |
|
||||
| F-SVC-7 | Same switches in the config file (`/etc/sharestead/config.yaml`) and in the setup wizard, so it works without the UI (automation, Ansible) | M | MVP |
|
||||
| F-SVC-7 | Same switches in the setup wizard. Without the UI (automation, Ansible): plain `systemctl enable/disable --now <unit>`, documented; Sharestead reads the state from systemd, so there is no second config file to keep in sync (owner's decision 2026-11-29) | M | MVP |
|
||||
| F-SVC-8 | Packages for optional protocols aren't required: the `.deb` only *recommends* them. A protocol whose package is missing shows "not installed" + the install command | M | MVP |
|
||||
|
||||
### Protocols (beyond SMB)
|
||||
|
||||
@@ -332,19 +332,9 @@ At start (and on demand), each module reports: *available?*, *why not?*, *settin
|
||||
| *available* | package installed, system can run it (detected) | the system |
|
||||
| *enabled* | the admin wants it | UI, wizard or config file |
|
||||
|
||||
Only *available + enabled* modules are active. Default after install: `smb` + discovery. Config file example:
|
||||
Only *available + enabled* modules are active. Default after install: `smb` + discovery.
|
||||
|
||||
```yaml
|
||||
# /etc/sharestead/config.yaml
|
||||
services:
|
||||
smb: { enabled: true }
|
||||
discovery: { windows: true, mac: true, netbios: false }
|
||||
dlna: { enabled: false }
|
||||
nfs: { enabled: false }
|
||||
sftp: { enabled: false, port: 2222 }
|
||||
webdav: { enabled: false }
|
||||
ftp: { enabled: false }
|
||||
```
|
||||
**systemd is the source of truth** for system-served services (like `smb.conf` for shares): Sharestead reads `is-enabled`/`is-active` and switches with `systemctl enable/disable --now`. There is no separate config file for the switches, so automation (Ansible, scripts) uses `systemctl` directly and the UI shows the result. App-served protocols (SFTP, WebDAV, later) keep their switch in the app's settings.
|
||||
|
||||
| Switch off | What happens |
|
||||
|---|---|
|
||||
|
||||
@@ -66,3 +66,26 @@ Access is set **once per share** and applies to every protocol. But protocols di
|
||||
| NFS | the **device** (IP/network); the user ID the device sends is trusted | only for devices you trust (Proxmox, media server, Linux PCs). Per-user rules need ACLs and still rely on the device telling the truth |
|
||||
|
||||
The share page lists, for each enabled protocol, what it enforces and what not.
|
||||
|
||||
## Switching services without the UI
|
||||
|
||||
Sharestead reads the service state from systemd, so scripts and tools like Ansible can switch
|
||||
services directly; the UI shows the result.
|
||||
|
||||
| Service | systemd unit |
|
||||
|---|---|
|
||||
| SMB | `smbd` |
|
||||
| NFS | `nfs-server` |
|
||||
| Windows discovery | `wsdd2` |
|
||||
| Mac discovery | `avahi-daemon` |
|
||||
| NetBIOS (old devices) | `nmbd` |
|
||||
| DLNA | `minidlna` |
|
||||
|
||||
```bash
|
||||
# on the Sharestead system (root)
|
||||
UNIT=nfs-server
|
||||
systemctl disable --now "$UNIT" # switch off
|
||||
systemctl enable --now "$UNIT" # switch on
|
||||
```
|
||||
|
||||
✅ Check: the *Services* page shows the new state.
|
||||
@@ -7,13 +7,17 @@ export default defineConfig({
|
||||
outputDir: './e2e-results',
|
||||
reporter: [['list'], ['html', { open: 'never', outputFolder: './e2e-report' }]],
|
||||
timeout: 30_000,
|
||||
// CI: one retry; a test that only passes on retry is reported as flaky.
|
||||
retries: process.env.CI ? 1 : 0,
|
||||
// One browser at a time: tests change the same smb.conf, and parallel edits
|
||||
// would (correctly) end in conflicts.
|
||||
workers: 1,
|
||||
use: {
|
||||
baseURL: process.env.SST_URL ?? 'https://127.0.0.1:8443',
|
||||
ignoreHTTPSErrors: true, // self-signed certificate
|
||||
trace: 'retain-on-failure',
|
||||
// Recording a trace for every test costs about a third of the CPU;
|
||||
// record only when a test is retried.
|
||||
trace: 'on-first-retry',
|
||||
},
|
||||
projects: [
|
||||
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
||||
|
||||
Reference in new issue
Block a user