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 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 ######################################## ########################################################################## - name: login server | Build `test` image run: | docker build --target test -t "gradido/login_server:test" -f ./login_server/Dockerfile login_server/ docker save "gradido/login_server:test" > /tmp/login_server.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: docker-login-server-test path: /tmp/login_server.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 #################################### ########################################################################## - name: community server | Build `test` image run: | docker build -t "gradido/community_server:test" -f ./community_server/Dockerfile ./ docker save "gradido/community_server:test" > /tmp/community_server.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: docker-community-server-test path: /tmp/community_server.tar ############################################################################## # JOB: DOCKER BUILD TEST MARIADB ############################################# ############################################################################## build_test_mariadb: name: Docker Build Test - MariaDB runs-on: ubuntu-latest #needs: [nothing] steps: ########################################################################## # CHECKOUT CODE ########################################################## ########################################################################## - name: Checkout code uses: actions/checkout@v2 ########################################################################## # BUILD MARIADB DOCKER IMAGE ############################################# ########################################################################## - name: mariadb | Build `test` image run: | docker build --target mariadb_server_test -t "gradido/mariadb:test" -f ./mariadb/Dockerfile ./ docker save "gradido/mariadb:test" > /tmp/mariadb.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: docker-mariadb-test path: /tmp/mariadb.tar ############################################################################## # JOB: DOCKER BUILD TEST NGINX ############################################### ############################################################################## build_test_nginx: name: Docker Build Test - Nginx runs-on: ubuntu-latest #needs: [nothing] steps: ########################################################################## # CHECKOUT CODE ########################################################## ########################################################################## - name: Checkout code uses: actions/checkout@v2 ########################################################################## # BUILD NGINX DOCKER IMAGE ############################################# ########################################################################## - name: nginx | Build `test` image run: | docker build -t "gradido/nginx:test" -f ./nginx/Dockerfile ./ docker save "gradido/nginx:test" > /tmp/nginx.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: docker-nginx-test path: /tmp/nginx.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: 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 (Frontend) 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 -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test cp -r ~/coverage ./coverage ########################################################################## # COVERAGE REPORT FRONTEND ################################################ ########################################################################## #- name: frontend | Coverage report # uses: romeovs/lcov-reporter-action@v0.2.21 # with: # github-token: ${{ secrets.GITHUB_TOKEN }} # lcov-file: ./coverage/lcov.info ########################################################################## # COVERAGE CHECK FRONTEND ################################################ ########################################################################## - name: frontend | Coverage check uses: webcraftmedia/coverage-check-action@master with: report_name: Coverage Frontend type: lcov result_path: ./coverage/lcov.info min_coverage: 19 token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST LOGIN-SERVER ############################################### ############################################################################## unit_test_login_server: name: Unit tests - Login-Server runs-on: ubuntu-latest needs: [build_test_login_server] services: mariadb: image: gradido/mariadb:test env: MARIADB_ALLOW_EMPTY_PASSWORD: 1 MARIADB_USER: root ports: - 3306:3306 volumes: - db_vol:/var/lib/mysql steps: ########################################################################## # CHECKOUT CODE ########################################################## ########################################################################## - name: Checkout code uses: actions/checkout@v2 ########################################################################## # DOWNLOAD DOCKER IMAGE ################################################## ########################################################################## - name: Download Docker Image (Login-Server) uses: actions/download-artifact@v2 with: name: docker-login-server-test path: /tmp - name: Load Docker Image run: docker load < /tmp/login_server.tar ########################################################################## # UNIT TESTS BACKEND LOGIN-SERVER ####################################### ########################################################################## - name: Login-Server | Unit tests run: | docker run -v ~/coverage:/code/build/coverage -v ~/configs/login_server/Gradido_LoginServer_Test.properties:/code/build/Gradido_LoginServer_Test.properties gradido/login_server:test --entrypoint cp -r ~/coverage ./coverage ########################################################################## # COVERAGE CHECK BACKEND LOGIN-SERVER #################################### ########################################################################## - name: backend | Coverage check uses: webcraftmedia/coverage-check-action@master with: report_name: Coverage Backend type: lcov result_path: ./coverage/lcov.info min_coverage: 8 token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST COMMUNITY-SERVER ########################################### ############################################################################## unit_test_community_server: name: Unit tests - Community Server runs-on: ubuntu-latest needs: [build_test_community_server] services: nginx: image: gradido/nginx:latest ports: - 80:80 mariadb: image: gradido/mariadb:test env: MARIADB_ALLOW_EMPTY_PASSWORD: 1 MARIADB_USER: root ports: - 3306:3306 volumes: - db_vol:/var/lib/mysql login-server: image: gradido/login_server:latest ports: - 1200:1200 - 1201:1201 volumes: - ./configs/login_server:/etc/grd_login steps: ########################################################################## # CHECKOUT CODE ########################################################## ########################################################################## - name: Checkout code uses: actions/checkout@v2 ########################################################################## # DOWNLOAD DOCKER IMAGE ################################################## ########################################################################## - name: Download Docker Image (Community-Server) uses: actions/download-artifact@v2 with: name: docker-community-server-test path: /tmp - name: Load Docker Image run: docker load < /tmp/community_server.tar ########################################################################## # UNIT TESTS BACKEND COMMUNITY-SERVER ####################################### ########################################################################## - name: Login-Server | Unit tests run: | docker run -v ~/coverage:/code/build/coverage -v gradido/login_server:test " ./vendor/bin/phpunit --coverage-html ./coverage" cp -r ~/coverage ./coverage ########################################################################## # COVERAGE CHECK BACKEND COMMUNITY-SERVER #################################### ########################################################################## - name: backend | Coverage check uses: webcraftmedia/coverage-check-action@master with: report_name: Coverage Backend type: lcov result_path: ./coverage/lcov.info min_coverage: 8 token: ${{ github.token }} #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