chore: set up Github deploy workflows #1
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: deploy | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ["18.17.0"] | |
services: | |
mongodb: | |
image: mongo | |
ports: | |
- 27017:27017 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
env: | |
NODE_ENV: ci | |
PORT: 3000 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies | |
run: | | |
npm install --legacy-peer-deps | |
npm run build | |
- name: Start server | |
run: | | |
nohup npm run start & | |
sleep 3 | |
- name: Run tests | |
run: npm run test |