Merge pull request #55 from wtfdivyansh/feature/backend #153
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |