Skip to content

Merge pull request #56 from wtfdivyansh/feature/backend #155

Merge pull request #56 from wtfdivyansh/feature/backend

Merge pull request #56 from wtfdivyansh/feature/backend #155

name: Run Test on Multiple Node Versions
on:
push:
branches:
- main
- 'feature/*'
- 'bugfix/*'
pull_request:
branches:
- main
- 'feature/*'
- 'bugfix/*'
jobs:
test:
runs-on: ubuntu-latest
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
RESEND_API: ${{ secrets.RESEND_API }}
strategy:
matrix:
node-version: [20.18.0, 18.20.4, 22.11.0, 19.9.0, 23.1.0] # Ensure all versions are >= v18
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up .env file for tests in apps/api
run: |
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> apps/api/.env
echo "RESEND_API=${{ secrets.RESEND_API }}" >> apps/api/.env
- name: Set environment variables for vitest in apps/api
run: |
echo "RESEND_API=${{ secrets.RESEND_API }}" >> apps/api/.env
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> apps/api/.env
cat apps/api/.env # Add this line to log and verify env variables
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
run: npm install -g pnpm
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install
- name: Log environment variables for verification (debug)
run: |
echo "DATABASE_URL=$DATABASE_URL"
echo "RESEND_API=$RESEND_API"
- name: Run tests
run: pnpm test