Skip to content

Commit 5ee84b7

Browse files
gwleclercclaude
andcommitted
build,ci: consolidate output under build/ and switch CI to npm/oxlint/vitest
- Makefile: coverage -> build/coverage, integration sessions -> build/sessions, integration test binary -> build/smocker.test, clean removes build/ only, and the release tarball packages only `smocker` + `client` (not test/runtime output). - Playwright output dir -> build/e2e (see playwright.config.ts). - sonar coverage report path -> build/coverage/cover.out. - CI: yarn -> npm (cache + `npm ci`), lint via `npm run lint` (oxlint), unit tests via `npm test` (vitest); ::set-output -> $GITHUB_OUTPUT. - .gitignore: everything generated now lives under build/, so ignore just build/ and node_modules/ (plus editor/OS files); drop the stale root-level entries. The repository root now stays clean: builds, coverage, e2e reports and runtime sessions all land under build/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 945d503 commit 5ee84b7

4 files changed

Lines changed: 36 additions & 36 deletions

File tree

.github/workflows/main.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
- uses: actions/setup-node@v4
2626
with:
2727
node-version-file: .nvmrc
28-
cache: yarn
28+
cache: npm
2929

30-
- run: yarn install --frozen-lockfile
30+
- run: npm ci
3131

3232
- name: Lint sources
3333
run: |
3434
make lint
35-
yarn lint
35+
npm run lint
3636
3737
test:
3838
runs-on: ubuntu-latest
@@ -45,21 +45,21 @@ jobs:
4545
- uses: actions/setup-node@v4
4646
with:
4747
node-version-file: .nvmrc
48-
cache: yarn
48+
cache: npm
4949

5050

5151
- name: Setup Go environment
5252
uses: actions/setup-go@v5
5353
with:
5454
go-version: stable
5555

56-
- run: yarn install --frozen-lockfile
56+
- run: npm ci
5757

5858
- name: Execute tests
5959
run: |
6060
make test
6161
make test-integration
62-
yarn test
62+
npm test
6363
make coverage
6464
6565
- name: SonarCloud Scan
@@ -76,19 +76,19 @@ jobs:
7676
- uses: actions/checkout@v4
7777

7878
- id: extract_ref
79-
run: echo ::set-output name=GIT_REF::$(echo ${GITHUB_REF##*/})
79+
run: echo "GIT_REF=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
8080

8181
- uses: actions/setup-node@v4
8282
with:
8383
node-version-file: .nvmrc
84-
cache: yarn
84+
cache: npm
8585

8686
- name: Setup Go environment
8787
uses: actions/setup-go@v5
8888
with:
8989
go-version: stable
9090

91-
- run: yarn install --frozen-lockfile
91+
- run: npm ci
9292

9393
- name: Build
9494
run: |
@@ -111,7 +111,7 @@ jobs:
111111
- uses: actions/checkout@v4
112112

113113
- id: extract_ref
114-
run: echo ::set-output name=GIT_REF::$(echo ${GITHUB_REF##*/})
114+
run: echo "GIT_REF=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
115115

116116
- uses: actions/download-artifact@v4
117117
with:

.gitignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
.DS_Store
22
.vscode/
3-
build/
4-
coverage/
53
node_modules/
6-
sessions
7-
!tests/sessions
8-
smocker
9-
smocker.test
10-
# Playwright E2E artifacts
11-
test-results/
12-
playwright-report/
4+
# All build, test and runtime output goes here (see Makefile / vite.config.ts / playwright.config.ts).
5+
build/

Makefile

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,24 @@ CADDY=$(GOPATH)/bin/caddy
5252
$(CADDY):
5353
cd /tmp; go get github.com/caddyserver/caddy/v2/...
5454

55+
# All generated/runtime artifacts live under build/ so the repository root stays clean.
56+
BUILD_DIR=build
57+
SESSIONS_DIR=$(BUILD_DIR)/sessions
58+
COVERAGE_DIR=$(BUILD_DIR)/coverage
59+
5560
.PHONY: persistence
5661
persistence:
57-
rm -rf ./sessions || true
58-
cp -r tests/sessions sessions
62+
rm -rf ./$(SESSIONS_DIR) || true
63+
mkdir -p $(BUILD_DIR)
64+
cp -r tests/sessions $(SESSIONS_DIR)
5965

6066
.PHONY: start
6167
start: $(REFLEX) persistence
6268
$(REFLEX) --start-service \
6369
--decoration='none' \
6470
--regex='\.go$$' \
6571
--inverse-regex='^vendor|node_modules|.cache/' \
66-
-- go run $(GO_LDFLAGS) main.go --log-level=$(LEVEL) --static-files ./build/client --persistence-directory ./sessions
72+
-- go run $(GO_LDFLAGS) main.go --log-level=$(LEVEL) --static-files ./build/client --persistence-directory ./$(SESSIONS_DIR)
6773

6874
.PHONY: build
6975
build:
@@ -79,15 +85,15 @@ format:
7985

8086
.PHONY: test
8187
test:
82-
mkdir -p coverage
83-
go test -v -race -coverprofile=coverage/test-cover.out ./server/...
88+
mkdir -p $(COVERAGE_DIR)
89+
go test -v -race -coverprofile=$(COVERAGE_DIR)/test-cover.out ./server/...
8490

8591
PID_FILE=/tmp/$(APPNAME).test.pid
8692
.PHONY: test-integration
8793
test-integration: $(VENOM) check-default-ports persistence
88-
mkdir -p coverage
89-
go test -race -coverpkg="./..." -c . -o $(APPNAME).test
90-
SMOCKER_PERSISTENCE_DIRECTORY=./sessions ./$(APPNAME).test -test.coverprofile=coverage/test-integration-cover.out >/dev/null 2>&1 & echo $$! > $(PID_FILE)
94+
mkdir -p $(COVERAGE_DIR)
95+
go test -race -coverpkg="./..." -c . -o $(BUILD_DIR)/$(APPNAME).test
96+
SMOCKER_PERSISTENCE_DIRECTORY=./$(SESSIONS_DIR) $(BUILD_DIR)/$(APPNAME).test -test.coverprofile=$(COVERAGE_DIR)/test-integration-cover.out >/dev/null 2>&1 & echo $$! > $(PID_FILE)
9197
sleep 5
9298
$(VENOM) run tests/features/$(SUITE)
9399
kill `cat $(PID_FILE)` 2> /dev/null || true
@@ -96,19 +102,19 @@ test-integration: $(VENOM) check-default-ports persistence
96102
start-integration: $(VENOM)
97103
$(VENOM) run tests/features/$(SUITE)
98104

99-
coverage/test-cover.out:
105+
$(COVERAGE_DIR)/test-cover.out:
100106
$(MAKE) test
101107

102-
coverage/test-integration-cover.out:
108+
$(COVERAGE_DIR)/test-integration-cover.out:
103109
$(MAKE) test-integration
104110

105111
.PHONY: coverage
106-
coverage: $(GOCOVMERGE) coverage/test-cover.out coverage/test-integration-cover.out
107-
$(GOCOVMERGE) coverage/test-cover.out coverage/test-integration-cover.out > coverage/cover.out
112+
coverage: $(GOCOVMERGE) $(COVERAGE_DIR)/test-cover.out $(COVERAGE_DIR)/test-integration-cover.out
113+
$(GOCOVMERGE) $(COVERAGE_DIR)/test-cover.out $(COVERAGE_DIR)/test-integration-cover.out > $(COVERAGE_DIR)/cover.out
108114

109115
.PHONY: clean
110116
clean:
111-
rm -rf ./build ./coverage
117+
rm -rf ./$(BUILD_DIR)
112118

113119
.PHONY: build-docker
114120
build-docker:
@@ -133,9 +139,10 @@ optimize:
133139

134140
build/smocker.tar.gz:
135141
$(MAKE) build
136-
yarn install --frozen-lockfile --ignore-scripts
137-
yarn build
138-
cd build/; tar -czvf smocker.tar.gz *
142+
npm ci --ignore-scripts
143+
npm run build
144+
# Package only the release artifacts, not test/runtime output that may also live in build/.
145+
cd build/; tar -czvf smocker.tar.gz smocker client
139146

140147
.PHONY: release
141148
release: build/smocker.tar.gz

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ sonar.organization=smocker
22
sonar.projectKey=Thiht_smocker
33
sonar.projectName=Smocker
44

5-
sonar.go.coverage.reportPaths=coverage/cover.out
5+
sonar.go.coverage.reportPaths=build/coverage/cover.out

0 commit comments

Comments
 (0)