diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index aec95af..3e0417a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,15 +6,54 @@ on: - development jobs: + test: + runs-on: ubuntu-latest + environment: test + + services: + mongodb: + image: mongo:8 + ports: + - 27017:27017 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Run tests + env: + NODE_ENV: test + MONGODB_TEST_URI: mongodb://localhost:27017/test-ci + ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} + REFRESH_TOKEN_SECRET: ${{ secrets.REFRESH_TOKEN_SECRET }} + API_KEY: ${{ secrets.API_KEY }} + ACCESS_TOKEN_EXPIRES: 1m + REFRESH_TOKEN_EXPIRES: 7d + GOOGLE_CLIENT_ID: dummy + GOOGLE_CLIENT_SECRET: dummy + SLACK_CLIENT_ID: dummy + SLACK_CLIENT_SECRET: dummy + run: npm test + deploy: runs-on: ubuntu-latest + needs: test steps: - name: Checkout code - uses: actions/checkout@v4 # Updated version + uses: actions/checkout@v4 - name: Add SSH private key to agent - uses: webfactory/ssh-agent@v0.9.0 # Updated version + uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/.gitignore b/.gitignore index 1fd5e22..021c031 100755 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ dist/ structure.md CLAUDE.md -/docs/* \ No newline at end of file +/docs/* + +test-mcp-oauth.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c731043..bedf1ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Base -FROM node:lts-alpine AS base +FROM node:22-alpine AS base WORKDIR /app COPY package*.json ./ @@ -21,7 +21,7 @@ COPY . . RUN npm run build # Production -FROM node:lts-alpine AS production +FROM node:22-alpine AS production ENV NODE_ENV='production' RUN addgroup --system --gid 1001 nodejs diff --git a/package.json b/package.json index 1afb998..f642183 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "dev": "ts-node-dev --respawn --transpile-only -r tsconfig-paths/register src/index.ts", "build": "cross-env NODE_ENV=production tsc && tsc-alias", "start": "cross-env NODE_ENV=production node dist/src/index.js", - "test": "jest --detectOpenHandles", - "test:watch": "jest --watchAll --detectOpenHandles --forceExit", - "test:coverage": "jest --coverage" + "test": "cross-env NODE_ENV=test jest --detectOpenHandles", + "test:watch": "cross-env NODE_ENV=test jest --watchAll --detectOpenHandles --forceExit", + "test:coverage": "cross-env NODE_ENV=test jest --coverage" }, "repository": { "type": "git", diff --git a/src/config/dot-env.ts b/src/config/dot-env.ts index 2f043b0..099637d 100755 --- a/src/config/dot-env.ts +++ b/src/config/dot-env.ts @@ -10,4 +10,8 @@ if (process.env.DOCKER !== "true" && process.env.NODE_ENV === "production") { envConfig.path = "./.env.production"; } +if (process.env.DOCKER !== "true" && process.env.NODE_ENV === "test") { + envConfig.path = "./.env.test"; +} + export default envConfig;