baktainer/.forgejo/workflows/test.yml
James Paterni 6e7adc330f
Some checks failed
Build Docker Image / build (push) Failing after 1m1s
CI Pipeline / test (push) Failing after 1m57s
Minimal CI / test (push) Failing after 10s
Build and Push Docker Image / test (push) Failing after 1m18s
Shell-Only CI (No Actions) / test (push) Failing after 53s
Simple CI Pipeline / test (push) Failing after 1s
Run Tests / test (push) Failing after 1m15s
Build Docker Image / notify (push) Failing after 1s
CI Pipeline / build (push) Has been skipped
Minimal CI / build (push) Has been skipped
Build and Push Docker Image / build (push) Has been skipped
Shell-Only CI (No Actions) / build (push) Has been skipped
Simple CI Pipeline / build (push) Has been skipped
CI Pipeline / notify (push) Successful in 1s
Shell-Only CI (No Actions) / notify (push) Successful in 1s
Simple CI Pipeline / notify (push) Successful in 1s
Node+Ruby CI Pipeline / test (push) Failing after 5m41s
Node+Ruby CI Pipeline / build (push) Has been skipped
Node+Ruby CI Pipeline / notify (push) Successful in 1s
Fix working directory errors in Forgejo Actions workflows
- 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 <noreply@anthropic.com>
2025-07-15 11:40:10 -04:00

84 lines
No EOL
2.5 KiB
YAML

name: Run Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: docker
container:
image: ruby:3.3-alpine
steps:
- name: Install system dependencies including Node.js
run: |
# Detect package manager and install dependencies
if command -v apk >/dev/null 2>&1; then
# Alpine Linux
apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git curl tzdata nodejs npm
elif command -v apt-get >/dev/null 2>&1; then
# Debian/Ubuntu
apt-get update && apt-get install -y build-essential libffi-dev libpq-dev git curl tzdata nodejs npm
elif command -v yum >/dev/null 2>&1; then
# CentOS/RHEL
yum install -y gcc make libffi-devel postgresql-devel git curl tzdata nodejs npm
elif command -v dnf >/dev/null 2>&1; then
# Fedora
dnf install -y gcc make libffi-devel postgresql-devel git curl tzdata nodejs npm
else
echo "Package manager not found. Installing Node.js manually..."
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs || echo "Failed to install Node.js"
fi
- name: Checkout repository
uses: actions/checkout@v4
- name: Install bundler
run: |
cd app
gem install bundler -v 2.6.7
- name: Cache Ruby gems
uses: actions/cache@v4
with:
path: app/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('app/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- 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
- name: Upload coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: app/coverage/