Skip to content

Added testing pipeline #6

Added testing pipeline

Added testing pipeline #6

Workflow file for this run

name: Unit Tests
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [21.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
working-directory: server/
- name: Set up environment variables
env:
API_KEY: ${{ secrets.API_KEY }}
AUTH_DOMAIN: ${{ secrets.AUTH_DOMAIN }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
STORAGE_BUCKET: ${{ secrets.STORAGE_BUCKET }}
MESSAGING_SENDER_ID: ${{ secrets.MESSAGING_SENDER_ID }}
APP_ID: ${{ secrets.APP_ID }}
MESSAGE_OUTREACH_RADIUS: ${{ secrets.MESSAGE_OUTREACH_RADIUS }}
EXPRESS_PORT: ${{ secrets.EXPRESS_PORT }}
SOCKET_PORT: ${{ secrets.SOCKET_PORT }}
SOCKET_TEST_CLIENT_PORT: ${{ secrets.SOCKET_TEST_CLIENT_PORT }}
run: |
echo "API_KEY=${API_KEY}" >> .env
echo "AUTH_DOMAIN=${AUTH_DOMAIN}" >> .env
echo "PROJECT_ID=${PROJECT_ID}" >> .env
echo "STORAGE_BUCKET=${STORAGE_BUCKET}" >> .env
echo "MESSAGING_SENDER_ID=${MESSAGING_SENDER_ID}" >> .env
echo "APP_ID=${APP_ID}" >> .env
echo "message_outreach_radius=${MESSAGE_OUTREACH_RADIUS}" >> .env
echo "express_port=${EXPRESS_PORT}" >> .env
echo "socket_port=${SOCKET_PORT}" >> .env
echo "socket_test_client_port=${SOCKET_TEST_CLIENT_PORT}" >> .env
working-directory: server/
- name: Compile TypeScript files
run: npx tsc
working-directory: server/
- name: Start index.ts in background
run: npm start &
working-directory: server/
- name: Wait for server to start
run: sleep 5 # Adjust sleep time as needed to allow the server to start
timeout-minutes: 1
- name: Run tests
run: npm test
working-directory: server/