# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: DevFlow MCP Tests
on:
push:
branches: [ "**" ] # Trigger on all branches
pull_request:
branches: [ "**" ] # Trigger on all PRs
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
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'
# Fix for rollup optional dependencies issue
- name: Clean npm cache
run: |
rm -rf node_modules
rm -f package-lock.json
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build --if-present
- name: Create mock .env file for tests
run: |
echo "# Mock environment for CI testing" >> .env
echo "# This enables tests to run without a real OpenAI API key" >> .env
echo "OPENAI_API_KEY=sk-mock-api-key-for-tests" >> .env
echo "OPENAI_EMBEDDING_MODEL=text-embedding-3-small" >> .env
echo "# The MOCK_EMBEDDINGS flag forces the use of DefaultEmbeddingService" >> .env
echo "# which generates random vectors instead of calling the OpenAI API" >> .env
echo "MOCK_EMBEDDINGS=true" >> .env
echo "ENV_FILE_CREATED=true" >> .env
cat .env
- name: Run tests
run: npm test
env:
DFM_ENV: testing
DFM_SQLITE_LOCATION: ":memory:"
OPENAI_API_KEY: sk-mock-api-key-for-tests
OPENAI_EMBEDDING_MODEL: text-embedding-3-small
MOCK_EMBEDDINGS: true
- name: Run test coverage
run: npm run test:coverage
env:
DFM_ENV: testing
DFM_SQLITE_LOCATION: ":memory:"
OPENAI_API_KEY: sk-mock-api-key-for-tests
OPENAI_EMBEDDING_MODEL: text-embedding-3-small
MOCK_EMBEDDINGS: true
publish:
name: Publish to npm
needs: build
if: github.ref == 'refs/heads/main'
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
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
rm -rf node_modules
rm -f package-lock.json
npm install
- name: Build package
run: npm run build
- name: Set executable permissions
run: chmod +x dist/*.js
- name: Check version and determine if publish is needed
id: check_version
run: |
# Get current version from package.json
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version in package.json: $CURRENT_VERSION"
# Get latest version from npm (if it exists)
if LATEST_VERSION=$(npm view @takin-profit/devflow-mcp version 2>/dev/null); then
echo "Latest published version: $LATEST_VERSION"
# Compare versions using node
IS_HIGHER=$(node -e "const semver = require('semver'); console.log(semver.gt('$CURRENT_VERSION', '$LATEST_VERSION') ? 'true' : 'false')")
echo "is_higher=$IS_HIGHER" >> $GITHUB_OUTPUT
if [ "$IS_HIGHER" = "true" ]; then
echo "Current version is higher than latest published version. Proceeding with publish."
else
echo "Current version is not higher than latest published version. Skipping publish."
fi
else
echo "No published version found. This appears to be the first publish."
echo "is_higher=true" >> $GITHUB_OUTPUT
fi
- name: Publish to npm
if: steps.check_version.outputs.is_higher == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Skip publish - version not higher
if: steps.check_version.outputs.is_higher != 'true'
run: echo "✅ Build successful but publish skipped - current version is not higher than the latest published version."
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Takin-Profit/devflow-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server