Skip to content

Setting up test scripts in CI/CD #22

Setting up test scripts in CI/CD

Setting up test scripts in CI/CD #22

Workflow file for this run

name: VisionIndex CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint-secrets-tests:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3
# 2. Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
# 3. Install dependencies
- name: Install Dependencies
run: npm install
working-directory: ./app
# 4. Run ESLint
- name: Run Linter
run: npm run lint
working-directory: ./app
# 5. Secret scan (Gitleaks)
- name: Run Secret Scan (Gitleaks)
run: |
curl -sL https://github.com/zricethezav/gitleaks/releases/download/v8.16.1/gitleaks_8.16.1_linux_x64.tar.gz | tar xz
./gitleaks detect --redact --exit-code=1
# 6. Run tests (with env vars from GitHub secrets)
- name: Run Tests
env:
MONGO_URI: ${{ secrets.MONGO_URI }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
JWT_REFRESH_SECRET: ${{ secrets.JWT_REFRESH_SECRET }}
NODE_ENV: test
run: npm test
working-directory: ./app