Skip to content

First draft of the test suite #1

First draft of the test suite

First draft of the test suite #1

Workflow file for this run

name: Integration Tests
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build CLI
run: npm run build
- name: Run unit tests (if any)
run: npm test -- --testPathPattern="unit" --passWithNoTests
- name: Check integration test credentials
env:
AGILITY_GUID: ${{ secrets.AGILITY_GUID }}
AGILITY_TOKEN: ${{ secrets.AGILITY_TOKEN }}
run: |
if [ -z "$AGILITY_GUID" ] || [ -z "$AGILITY_TOKEN" ]; then
echo "❌ Integration tests require AGILITY_GUID and AGILITY_TOKEN secrets"
echo "📝 Please configure these secrets in your GitHub repository settings"
echo "💡 These tests use PAT authentication only - no Auth0 flow in CI/CD"
echo "⚠️ Skipping integration tests due to missing credentials"
exit 0
fi
echo "✅ Integration test credentials are configured"
- name: Run integration tests
env:
AGILITY_GUID: ${{ secrets.AGILITY_GUID }}
AGILITY_TOKEN: ${{ secrets.AGILITY_TOKEN }}
AGILITY_WEBSITE: ${{ secrets.AGILITY_WEBSITE || 'website' }}
AGILITY_LOCALES: ${{ secrets.AGILITY_LOCALES || 'en-us' }}
TEST_VERBOSE: true
run: |
if [ -n "$AGILITY_GUID" ] && [ -n "$AGILITY_TOKEN" ]; then
echo "🚀 Running essential integration tests with PAT authentication..."
# Run basic tests for CI/CD (fast and lightweight)
npm run test:pull-basic
npm run test:auth
else
echo "⏭️ Skipping integration tests: credentials not configured"
fi
- name: Run linting
run: |
if npm list --depth=0 | grep -q eslint; then
npm run lint
else
echo "ESLint not configured, skipping linting"
fi
continue-on-error: true
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.node-version }}
path: |
coverage/
test-results.xml
retention-days: 7
security:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run security audit
run: npm audit --audit-level=moderate
continue-on-error: true
- name: Check for vulnerabilities
run: |
if npm audit --audit-level=high --json | grep -q '"vulnerabilities"'; then
echo "High-severity vulnerabilities found"
npm audit --audit-level=high
exit 1
else
echo "No high-severity vulnerabilities found"
fi