diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..82a07e7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +name: CI + +on: + push: + branches: [main, dev, master] + pull_request: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + backend: + name: Backend — lint / typecheck / test + runs-on: ubuntu-latest + defaults: + run: + working-directory: backend + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: backend/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + - name: Type-check + run: npm run typecheck + + - name: Run tests + run: npm test + env: + NODE_ENV: test + PUBLIC_APP_URL: http://localhost:5173 + FRONTEND_URL: http://localhost:5173 + ADMIN_API_KEY: ci-test-admin-key + GDRIVE_CLIENT_ID: placeholder + GDRIVE_CLIENT_SECRET: placeholder + GDRIVE_REFRESH_TOKEN: placeholder + + - name: Build + run: npm run build + + frontend: + name: Frontend — lint / test / build + runs-on: ubuntu-latest + defaults: + run: + working-directory: cshare-app + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: cshare-app/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + - name: Run tests + run: npm test + + - name: Build + run: npm run build + env: + VITE_API_BASE_URL: https://file.asabbagh.com