Add missing node #258
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
# 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] | |
mongodb-version: [4.4.0] | |
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] | |
mongodb-version: [4.4.0] | |
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 -- ./tests/bacterium_api.test.js | |
- run: npm run test-githubactions -- ./tests/test_api.test.js | |
- run: npm run test-githubactions -- ./tests/user_api.test.js | |
- run: npm run test-githubactions -- ./tests/credit_api.test.js | |
- run: npm run test-githubactions -- ./tests/game_api.test.js | |
- run: npm run test-githubactions -- ./tests/case_api.test.js | |
- run: npm run test-githubactions -- ./tests/game_testing.test.js | |
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: 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 | |