From 6e7adc330f87c4680d831c38f481d42246d8d0e2 Mon Sep 17 00:00:00 2001 From: James Paterni Date: Tue, 15 Jul 2025 11:40:10 -0400 Subject: [PATCH] Fix working directory errors in Forgejo Actions workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove working-directory defaults that caused chdir errors - Use explicit 'cd app' commands in all Ruby-related steps - Fix ci.yml, test.yml, docker.yml, and shell-only.yml workflows - Update documentation with working directory troubleshooting The error occurred because working-directory was set before repository checkout, causing the container to try to start in a non-existent directory. Resolves: "chdir to cwd (..../app) set in config.json failed: no such file" ๐Ÿค– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .forgejo/README.md | 13 ++++++++++++- .forgejo/workflows/ci.yml | 9 +++++---- .forgejo/workflows/docker.yml | 5 ++--- .forgejo/workflows/shell-only.yml | 14 ++++++-------- .forgejo/workflows/test.yml | 11 +++++++---- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.forgejo/README.md b/.forgejo/README.md index 91fdd44..7d6e026 100644 --- a/.forgejo/README.md +++ b/.forgejo/README.md @@ -191,7 +191,18 @@ git push origin feature-branch - Alternative: Use `simple.yml` or `minimal.yml` (shell-based, limited actions) - Check your Forgejo runner configuration and container image support -2. **Actions not running** +2. **Working directory not found error** + ``` + OCI runtime exec failed: exec failed: unable to start container process: + chdir to cwd ("/workspace/james/baktainer/./app") set in config.json failed: + no such file or directory: unknown + ``` + **Solutions**: + - **Fixed**: All workflows now use explicit `cd app` commands instead of `working-directory` defaults + - The error occurred because `working-directory` was set before repository checkout + - Repository must be cloned/checked out before changing to subdirectories + +3. **Actions not running** - Check if Repository Actions are enabled - Verify Forgejo Runner is installed and running - Check workflow file syntax diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index bbaf4c7..2fec1a4 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -15,9 +15,6 @@ jobs: runs-on: docker container: image: ruby:3.3-alpine - defaults: - run: - working-directory: ./app steps: - name: Install system dependencies including Node.js @@ -46,7 +43,9 @@ jobs: uses: actions/checkout@v4 - name: Install bundler - run: gem install bundler -v 2.6.7 + run: | + cd app + gem install bundler -v 2.6.7 - name: Cache Ruby gems uses: actions/cache@v4 @@ -58,11 +57,13 @@ jobs: - name: Install Ruby dependencies run: | + cd app bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: Run RSpec tests run: | + cd app mkdir -p tmp bundle exec rspec \ --format progress \ diff --git a/.forgejo/workflows/docker.yml b/.forgejo/workflows/docker.yml index 5abc797..4a4a0d4 100644 --- a/.forgejo/workflows/docker.yml +++ b/.forgejo/workflows/docker.yml @@ -12,9 +12,6 @@ jobs: runs-on: docker container: image: ruby:3.3-alpine - defaults: - run: - working-directory: ./app steps: - name: Install system dependencies including Node.js @@ -43,12 +40,14 @@ jobs: - name: Install Ruby dependencies run: | + cd app gem install bundler -v 2.6.7 bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: Run RSpec tests run: | + cd app mkdir -p tmp bundle exec rspec \ --format progress \ diff --git a/.forgejo/workflows/shell-only.yml b/.forgejo/workflows/shell-only.yml index c037165..359689a 100644 --- a/.forgejo/workflows/shell-only.yml +++ b/.forgejo/workflows/shell-only.yml @@ -15,9 +15,6 @@ jobs: runs-on: docker container: image: ruby:3.3-alpine - defaults: - run: - working-directory: ./app steps: - name: Install system dependencies @@ -39,22 +36,23 @@ jobs: - name: Clone repository run: | - git clone ${{ github.server_url }}/${{ github.repository }}.git /workspace - cd /workspace + git clone ${{ github.server_url }}/${{ github.repository }}.git . git checkout ${{ github.sha }} - cp -r /workspace/* . - cp -r /workspace/.* . 2>/dev/null || true - name: Install bundler - run: gem install bundler -v 2.6.7 + run: | + cd app + gem install bundler -v 2.6.7 - name: Install Ruby dependencies run: | + cd app bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: Run RSpec tests run: | + cd app mkdir -p tmp bundle exec rspec --format progress diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 9fa1685..6174d7d 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -13,9 +13,6 @@ jobs: runs-on: docker container: image: ruby:3.3-alpine - defaults: - run: - working-directory: ./app steps: - name: Install system dependencies including Node.js @@ -43,7 +40,9 @@ jobs: uses: actions/checkout@v4 - name: Install bundler - run: gem install bundler -v 2.6.7 + run: | + cd app + gem install bundler -v 2.6.7 - name: Cache Ruby gems uses: actions/cache@v4 @@ -55,21 +54,25 @@ jobs: - name: Install Ruby dependencies run: | + cd app bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: Run unit tests run: | + cd app echo "๐Ÿงช Running unit tests..." bundle exec rspec spec/unit/ --format documentation - name: Run integration tests run: | + cd app echo "๐Ÿงช Running integration tests..." bundle exec rspec spec/integration/ --format documentation - name: Generate coverage report run: | + cd app echo "๐Ÿ“Š Generating coverage report..." COVERAGE=true bundle exec rspec --format progress