initial commit #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: Test and Dockerize | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 16.11.1 | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: "5.0.7" | |
- name: Start Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: latest | |
- name: Run tests | |
run: npm run test:detectOpen | |
env: | |
NODE_ENV: development | |
MONGO_URI: mongodb://localhost:27017/blg-prjct | |
MONGO_PASSWORD: | |
API_VERSION: 0.0.1 | |
PORT: 8371 | |
dockerize: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: mirzabicer/blg-prjct:latest |