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: true ########################################################################## # BUILD LOGIN SERVER DOCKER IMAGE ######################################## ########################################################################## - name: login server | Build `release` image run: | docker build -t "gradido/login_server:release" -f ./login_server/Dockerfile login_server/ ############################################################################## # 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: 32 token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST LOGIN-SERVER ############################################### ############################################################################## unit_test_login_server: name: Unit tests - Login-Server runs-on: ubuntu-latest needs: [] services: mariadb: image: gradido/mariadb:test env: MARIADB_ALLOW_EMPTY_PASSWORD: 1 MARIADB_USER: root ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval=6s --health-timeout=3s --health-retries=4 steps: - name: Debug service run: echo "$(docker ps)" - name: Debug container choosing script run: echo "$(docker container ls | grep mariadb | awk '{ print $1 }')" ########################################################################## # CHECKOUT CODE ########################################################## ########################################################################## - name: Checkout code uses: actions/checkout@v2 with: submodules: true ########################################################################## # Build Login-Server Test Docker image ################################### ########################################################################## - name: login server | Build `test` image run: | docker build -t "gradido/login_server:test" -f ./login_server/Dockerfiles/ubuntu/Dockerfile.test login_server/ ########################################################################## # UNIT TESTS BACKEND LOGIN-SERVER ####################################### ########################################################################## - name: Login-Server | Unit tests run: | docker run --network container:$(docker container ls | grep mariadb | awk '{ print $1 }') -v ~/coverage:/code/build_cov/coverage -v $(pwd)/configs/login_server:/etc/grd_login gradido/login_server:test cp -r ~/coverage ./coverage ########################################################################## # COVERAGE CHECK BACKEND LOGIN-SERVER #################################### ########################################################################## - name: backend login | Coverage check uses: webcraftmedia/coverage-check-action@master with: report_name: Coverage Backend Login type: lcov result_path: ./coverage/coverage.info min_coverage: 25 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: mariadb: image: gradido/mariadb:test env: MARIADB_ALLOW_EMPTY_PASSWORD: 1 MARIADB_USER: root # ports: # - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=5s --health-retries=3 steps: - name: get mariadb container id run: echo "::set-output name=id::$(docker container ls | grep mariadb | awk '{ print $1 }')" id: mariadb_container - name: show networks run: echo "$(docker network ls)" - name: get automatic created network run: echo "::set-output name=id::$(docker network ls | grep github_network | awk '{ print $1 }')" id: network - name: Start Login-Server run: docker run --network ${{ steps.network.outputs.id }} --name=login-server -d gradido/login_server:with-config - name: get login-server container id run: echo "::set-output name=id::$(docker container ls | grep login_server | awk '{ print $1 }')" id: login_server_container ########################################################################## # 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 # for debugging login-server - name: check login-server run: docker logs ${{ steps.login_server_container.outputs.id }} - name: check mariadb run: docker logs ${{ steps.mariadb_container.outputs.id }} ########################################################################## # UNIT TESTS BACKEND COMMUNITY-SERVER ####################################### ########################################################################## - name: community server | Unit tests run: | docker run --network ${{ steps.network.outputs.id }} -v ~/coverage:/var/www/cakephp/webroot/coverage gradido/community_server:test cp -r ~/coverage ./coverage ######################################################################### # COVERAGE CHECK BACKEND COMMUNITY-SERVER #################################### ########################################################################## - name: backend community | Coverage check uses: einhornimmond/coverage-check-action@master with: report_name: Coverage Backend Community type: phpunit result_path: ./coverage/coverage.info min_coverage: 14 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