Skip to content

fix: update GitHub Actions workflow to handle missing package-lock.json #2

fix: update GitHub Actions workflow to handle missing package-lock.json

fix: update GitHub Actions workflow to handle missing package-lock.json #2

Workflow file for this run

name: Test Suite
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies (if package.json exists)
run: |
if [ -f "package.json" ]; then
npm install
else
echo "No package.json found, skipping npm install"
fi
- name: Create test environment
run: |
mkdir -p ~/.afk
echo '{"telegram_bot_token":"test-token","telegram_chat_id":"123456789"}' > ~/.afk/config.json
echo "local" > ~/.afk/mode
- name: Run test suite
run: |
chmod +x test/run-tests.sh
./test/run-tests.sh
env:
AFK_NONINTERACTIVE: 1
CI: true
- name: Run individual test suites
run: |
echo "Running service integration tests..."
node test/test-service-integration.js
echo "Running stderr pollution tests..."
node test/test-stderr-and-error-handling.js
echo "Running service initialization tests..."
node test/test-service-initialization.js
env:
AFK_NONINTERACTIVE: 1
CI: true
- name: Check syntax of main binary
run: node -c bin/afk
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Check JavaScript syntax
run: |
find . -name "*.js" -not -path "./node_modules/*" -not -path "./.git/*" -exec node -c {} \;