Update project metadata and CI workflow #13
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: Testing | |
| strategy: | |
| matrix: | |
| node-version: [20.x, 22.x] | |
| max-parallel: 1 | |
| services: | |
| mongodb: | |
| image: mongo:latest | |
| options: >- | |
| --health-cmd mongosh | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 27017:27017 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| cache-dependency-path: | | |
| mern/server/package-lock.json | |
| mern/client/package-lock.json | |
| - name: Install server npm packages | |
| run: npm ci | |
| working-directory: mern/server | |
| - name: Install client npm packages | |
| run: npm ci | |
| working-directory: mern/client | |
| - name: Start server in the background | |
| env: | |
| ATLAS_URI: ${{ secrets.ATLAS_URI || 'mongodb://localhost:27017/' }} | |
| run: | | |
| echo "ATLAS_URI=$ATLAS_URI" > config.env | |
| npm start > /tmp/server.log 2>&1 & | |
| echo "Server PID: $!" | |
| working-directory: mern/server | |
| - name: Wait for server to be ready | |
| run: | | |
| npx wait-on http://localhost:5050/record --timeout 30000 || (cat /tmp/server.log && exit 1) | |
| - name: Install Cypress and run tests | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| working-directory: mern/client | |
| start: npm run dev | |
| wait-on: 'http://localhost:5173' | |