Skip to content

Update node-push.js.yml #213

Update node-push.js.yml

Update node-push.js.yml #213

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI on push
on:
push:
branches: [ master ]
jobs:
frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
strategy:
matrix:
node-version: [22.x]
mongodb-version: [4.4]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci && cd ../backend && npm ci && cd ../frontend && npm run library
- run: npm run build --if-present
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- run: cd ../backend && nohup npm run start:testServer &
env:
SECRET: ${{ secrets.SECRET }}
PORT: 3001
IMAGEURL: 'images'
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: chrome
working-directory: frontend
start: npm start
wait-on: http://localhost:3000
wait-on-timeout: 300
spec: cypress/e2e/*
backend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
strategy:
matrix:
node-version: [22.x]
mongodb-version: [4.4]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- run: npm ci
- run: npm run library
- run: npm run test-githubactions
env:
SECRET: ${{ secrets.SECRET }}
IMAGEURL: 'images'
build:
name: 'Publish to dockerhub'
needs: [frontend, backend]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish to Dockerhub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: hybakteeripeli/app
tags: latest
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: hybakteeripeli/app:latest