2021-03-22 20:50:45 +01:00

259 lines
12 KiB
YAML

name: gradido test CI
on: [push]
jobs:
##############################################################################
# JOB: DOCKER BUILD TEST FRONTEND ############################################
##############################################################################
build_test_frontend:
name: Docker Build Test - Frontend
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# FRONTEND ###############################################################
##########################################################################
- name: Frontend | Build `test` image
run: |
docker build --target test -t "gradido/frontend:test" frontend/
docker save "gradido/frontend:test" > /tmp/frontend.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-frontend-test
path: /tmp/frontend.tar
##############################################################################
# JOB: DOCKER BUILD TEST BACKEND #############################################
##############################################################################
#build_test_backend:
# name: Docker Build Test - Backend
# runs-on: ubuntu-latest
# needs: [prepare]
# steps:
# ##########################################################################
# # CHECKOUT CODE ##########################################################
# ##########################################################################
# - name: Checkout code
# uses: actions/checkout@v2
# ##########################################################################
# # BUILD BACKEND DOCKER IMAGE (build) #####################################
# ##########################################################################
# - name: backend | Build `test` image
# run: |
# docker build --target test -t "ocelotsocialnetwork/backend:test" backend/
# docker save "ocelotsocialnetwork/backend:test" > /tmp/backend.tar
# - name: Upload Artifact
# uses: actions/upload-artifact@v2
# with:
# name: docker-backend-test
# path: /tmp/backend.tar
##############################################################################
# JOB: DOCKER BUILD TEST LOGIN SERVER ########################################
##############################################################################
build_test_login_server:
name: Docker Build Test - Login Server
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
##########################################################################
# BUILD LOGIN SERVER DOCKER IMAGE (build) ################################
##########################################################################
- name: login server | Build `test` image
run: |
docker build --target login_server_debug -t "gradido/loginserver:test" -f ./login_server/Dockerfile.debug login_server/
docker save "gradido/loginserver:test" > /tmp/loginserver.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-loginserver-test
path: /tmp/loginserver.tar
##############################################################################
# JOB: DOCKER BUILD TEST COMMUNITY SERVER ####################################
##############################################################################
build_test_community_server:
name: Docker Build Test - Community Server
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# BUILD COMMUNITY SERVER DOCKER IMAGE (build) ############################
##########################################################################
- name: community server | Build `test` image
run: |
docker build -t "gradido/communityserver:test" -f ./community_server/Dockerfile ./
docker save "gradido/communityserver:test" > /tmp/communityserver.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-communityserver-test
path: /tmp/communityserver.tar
##############################################################################
# JOB: LINT FRONTEND #########################################################
##############################################################################
lint_frontend:
name: Lint frontend
runs-on: ubuntu-latest
needs: [build_test_frontend]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# DOWNLOAD DOCKER IMAGE ##################################################
##########################################################################
- name: Download Docker Image (Frontend)
uses: actions/download-artifact@v2
with:
name: docker-frontend-test
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/frontend.tar
##########################################################################
# LINT FRONTEND ###########################################################
##########################################################################
- name: frontend | Lint
run: docker run --rm gradido/frontend:test yarn run lint
##############################################################################
# JOB: LINT WEBAPP ###########################################################
##############################################################################
#lint_webapp:
# name: Lint webapp
# runs-on: ubuntu-latest
# needs: [build_test_webapp]
# steps:
# ##########################################################################
# # CHECKOUT CODE ##########################################################
# ##########################################################################
# - name: Checkout code
# uses: actions/checkout@v2
# ##########################################################################
# # DOWNLOAD DOCKER IMAGE ##################################################
# ##########################################################################
# - name: Download Docker Image (Webapp)
# uses: actions/download-artifact@v2
# with:
# name: docker-webapp-test
# path: /tmp
# - name: Load Docker Image
# run: docker load < /tmp/webapp.tar
# ##########################################################################
# # LINT WEBAPP ############################################################
# ##########################################################################
# - name: webapp | Lint
# run: docker run --rm ocelotsocialnetwork/webapp:test yarn run lint
##############################################################################
# JOB: UNIT TEST BACKEND #####################################################
##############################################################################
#unit_test_backend:
# name: Unit tests - backend
# runs-on: ubuntu-latest
# needs: [build_test_neo4j,build_test_backend]
# steps:
# ##########################################################################
# # CHECKOUT CODE ##########################################################
# ##########################################################################
# - name: Checkout code
# uses: actions/checkout@v2
# ##########################################################################
# # DOWNLOAD DOCKER IMAGES #################################################
# ##########################################################################
# - name: Download Docker Image (Neo4J)
# uses: actions/download-artifact@v2
# with:
# name: docker-neo4j-image
# path: /tmp
# - name: Load Docker Image
# run: docker load < /tmp/neo4j.tar
# - name: Download Docker Image (Backend)
# uses: actions/download-artifact@v2
# with:
# name: docker-backend-test
# path: /tmp
# - name: Load Docker Image
# run: docker load < /tmp/backend.tar
# ##########################################################################
# # UNIT TESTS BACKEND #####################################################
# ##########################################################################
# # TODO: Why do we need those .envs?
# - name: backend | copy env files webapp
# run: cp webapp/.env.template webapp/.env
# - name: backend | copy env files backend
# run: cp backend/.env.template backend/.env
# - name: backend | docker-compose
# run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps neo4j backend
# - name: backend | Initialize Database
# run: docker-compose exec -T backend yarn db:migrate init
# - name: backend | Unit test
# run: docker-compose exec -T backend yarn test
##############################################################################
# JOB: UNIT TEST FRONTEND ###################################################
##############################################################################
unit_test_frontend:
name: Unit tests - Frontend
runs-on: ubuntu-latest
needs: [build_test_frontend]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# DOWNLOAD DOCKER IMAGES #################################################
##########################################################################
- name: Download Docker Image (Webapp)
uses: actions/download-artifact@v2
with:
name: docker-frontend-test
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/frontend.tar
##########################################################################
# UNIT TESTS FRONTEND ####################################################
##########################################################################
- name: frontend | Unit tests
run: docker run --rm gradido/frontend:test yarn run test
#test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Build the stack
# run: |
# git submodule update --init --recursive
# docker-compose up -d
# - name: Test
# env:
# GN_INSTANCE_FOLDER: /tmp/gradio-node-instance
# GN_CONTAINER_NAME: gradido-node-build
# run: docker run gradido-node-test
# timeout-minutes: 2