Skip to content

Commit 72101dc

Browse files
ddworkenclaude
andauthored
Fix GitHub Action failures on master branch (#324)
* Fix GitHub Action failures on master branch This commit addresses two types of test failures: 1. macOS test failures: Updated golden test files to use bash 5.3 instead of bash 5.2, reflecting GitHub Actions' update of macOS-14 runners. 2. Docker Compose test failures: Fixed postgres startup issues by: - **ROOT CAUSE**: GitHub Actions environment change between April and October 2025 causing Docker volume permission issues - **FIX**: Pre-create volume with correct permissions (chmod 777) before starting containers - Restored PGDATA: /var/lib/postgresql/data/pgdata (was in working April config) - Added tmpfs mount for /var/run/postgresql - Using CMD-SHELL format with database name: pg_isready -U postgres -d hishtory - Adjusting timing parameters per Docker docs (interval: 10s, timeout: 10s, start_period: 30s, retries: 5) - Replaced depends_on service_healthy with explicit wait loop in workflow - Added comprehensive debug logging showing permission errors Debug logs revealed "mkdir: cannot create directory '/var/lib/postgresql/data': Permission denied". This configuration worked in April 2025 but fails in October, indicating a GitHub Actions Docker environment change. The workaround creates the volume and fixes permissions before starting services. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix Docker Compose test by setting proper volume ownership Instead of modifying docker-compose.yml (which real users depend on), fix the permission issue in the test workflow by: - Setting volume ownership to postgres user (uid 999) - Pre-creating the pgdata directory with proper permissions This maintains compatibility with the production docker-compose.yml while fixing the test environment permission issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Simplify volume permission setup The previous approach created directory structure that interfered with Docker's mount process. Now we: - Create the volume - Set ownership to postgres user (999:999) on the volume root - Let postgres create its own directory structure This avoids mount point conflicts while still fixing permissions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Use docker-compose override for test environment Instead of modifying the production docker-compose.yml, create a test-specific override file that uses an anonymous volume for postgres. This avoids the permission issues in GitHub Actions while keeping the production configuration unchanged for real users. The override file is layered on top of the main docker-compose.yml using multiple -f flags in the test workflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Use tmpfs for postgres data in test environment The anonymous volume approach still had permission issues. Using tmpfs for /var/lib/postgresql/data bypasses volume permission problems entirely since it's a memory filesystem. This is acceptable for testing since we don't need persistence. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Use /tmp/pgdata for test environment Instead of trying to override the volume mount with tmpfs (which creates conflicts), change PGDATA to /tmp/pgdata which is writable by the postgres user. Use !reset to clear volumes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Revert docker-compose.yml to avoid changing production config The test environment uses docker-compose.test.yml override instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Override depends_on to remove service_healthy condition in tests The main docker-compose.yml uses service_healthy which doesn't work well with the /tmp/pgdata setup. The workflow script handles the waiting explicitly instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Update TestStatusFullConfig golden for filterwhitespaceprefix The golden file was missing the filterwhitespaceprefix config field that is now included in the status output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove debug logging from docker-compose-test workflow Clean up the workflow by removing verbose debug output: - Container status checks - Verbose wait loop messages - Log upload artifacts Keep only essential functionality for cleaner output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Update remaining bash 5.3 golden files for macOS Fix remaining golden files that were still using bash-5.2: - testControlR-bash-Disabled-darwin - testControlR-SelectMultiline-bash-darwin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 06241cb commit 72101dc

7 files changed

Lines changed: 25 additions & 12 deletions

‎.github/workflows/docker-compose-test.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ jobs:
2323
curl -fsSL https://get.docker.com | sudo sh
2424
sudo chmod 0755 -R /usr/share/zsh/ # Work around a weird bug where zsh on ubuntu actions gives that diretory 0777 which makes zsh refuse to start
2525
sudo hostname ghaction-runner-hostname # Set a consistent hostname so we can run tests that depend on it
26-
docker compose -f backend/server/docker-compose.yml build
27-
HISHTORY_COMPOSE_TEST=1 docker compose -f backend/server/docker-compose.yml up -d
26+
docker compose -f backend/server/docker-compose.yml -f backend/server/docker-compose.test.yml build
27+
HISHTORY_COMPOSE_TEST=1 docker compose -f backend/server/docker-compose.yml -f backend/server/docker-compose.test.yml up -d
28+
# Wait for postgres to be ready
29+
timeout 90 bash -c 'until docker compose -f backend/server/docker-compose.yml -f backend/server/docker-compose.test.yml exec -T postgres pg_isready -U postgres -d hishtory 2>&1 > /dev/null; do sleep 2; done'
2830
export HISHTORY_SERVER=http://localhost
2931
go build
3032
./hishtory install
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Override for testing - uses tmpfs for data directory
2+
# to avoid permission issues in GitHub Actions
3+
services:
4+
postgres:
5+
environment:
6+
PGDATA: /tmp/pgdata # Use tmpfs instead of volume
7+
volumes: !reset [] # Remove persistent volume for testing
8+
hishtory:
9+
depends_on: !reset # Remove service_healthy condition, use explicit wait in workflow
10+
- postgres

‎client/testdata/TestStatusFullConfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Full Config:
1414
forcecompactmode: false
1515
isoffline: false
1616
filterduplicatecommands: false
17+
filterwhitespaceprefix: true
1718
timestampformat: Jan 2 2006 15:04:05 MST
1819
betamode: false
1920
highlightmatches: true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bash-5.2$ source /Users/runner/.bashrc
2-
bash-5.2$ echo
1+
bash-5.3$ source /Users/runner/.bashrc
2+
bash-5.3$ echo
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bash-5.2$ source /Users/runner/.bashrc
2-
bash-5.2$ ls -Slah /
1+
bash-5.3$ source /Users/runner/.bashrc
2+
bash-5.3$ ls -Slah /
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bash-5.2$ source /Users/runner/.bashrc
1+
bash-5.3$ source /Users/runner/.bashrc
22
(reverse-i-search)`':
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
bash-5.2$ source /Users/runner/.bashrc
2-
bash-5.2$ echo foo
1+
bash-5.3$ source /Users/runner/.bashrc
2+
bash-5.3$ echo foo
33
foo
4-
bash-5.2$ hishtory
4+
bash-5.3$ hishtory
55
bash: hishtory: command not found
6-
bash-5.2$ echo bar
6+
bash-5.3$ echo bar
77
bar
8-
bash-5.2$
8+
bash-5.3$

0 commit comments

Comments
 (0)