From 8716f39b91d710c12e7a7f8bef6971a4f2b27b5b Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 14 Mar 2023 16:23:10 +0100 Subject: [PATCH 01/17] add file filter for frontend test workflow --- .github/file-filters.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index e41dfb6d8..f3ec61fc2 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -28,4 +28,7 @@ # - *admin_unit_testing admin: &admin - - 'admin/**/*' \ No newline at end of file + - 'admin/**/*' + +frontend: &admin + - 'frontend/**/*' \ No newline at end of file From 16e166d4ac23a3b4b628f37bf0e7d0d067087bb4 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 14 Mar 2023 16:28:38 +0100 Subject: [PATCH 02/17] separate frontend test workflow from general test workflow --- .github/workflows/test.yml | 109 +--------------------------- .github/workflows/test_frontend.yml | 84 +++++++++++++++++++++ 2 files changed, 86 insertions(+), 107 deletions(-) create mode 100644 .github/workflows/test_frontend.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a9243af9..8ef9d2fcd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,32 +3,6 @@ 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@v3 - ########################################################################## - # 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@v3 - with: - name: docker-frontend-test - path: /tmp/frontend.tar - ############################################################################## # JOB: DOCKER BUILD TEST BACKEND ############################################# ############################################################################## @@ -132,60 +106,6 @@ jobs: name: docker-nginx-test path: /tmp/nginx.tar - ############################################################################## - # JOB: LOCALES FRONTEND ###################################################### - ############################################################################## - locales_frontend: - name: Locales - Frontend - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # LOCALES FRONTEND ####################################################### - ########################################################################## - - name: Frontend | Locales - run: cd frontend && yarn && yarn run locales - - ############################################################################## - # JOB: LINT FRONTEND ######################################################### - ############################################################################## - lint_frontend: - name: Lint - Frontend - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # LINT FRONTEND ########################################################## - ########################################################################## - - name: Frontend | Lint - run: cd frontend && yarn && yarn run lint - - ############################################################################## - # JOB: STYLELINT FRONTEND #################################################### - ############################################################################## - stylelint_frontend: - name: Stylelint - Frontend - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # STYLELINT FRONTEND ##################################################### - ########################################################################## - - name: Frontend | Stylelint - run: cd frontend && yarn && yarn run stylelint - ############################################################################## # JOB: LINT BACKEND ########################################################## ############################################################################## @@ -240,24 +160,6 @@ jobs: - name: Database | Lint run: cd database && yarn && yarn run lint - ############################################################################## - # JOB: UNIT TEST FRONTEND ################################################### - ############################################################################## - unit_test_frontend: - name: Unit tests - Frontend - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # UNIT TESTS FRONTEND #################################################### - ########################################################################## - - name: Frontend | Unit tests - run: cd frontend && yarn && yarn run test - ############################################################################## # JOB: UNIT TEST BACKEND #################################################### ############################################################################## @@ -323,7 +225,7 @@ jobs: end-to-end-tests: name: End-to-End Tests runs-on: ubuntu-latest - needs: [build_test_mariadb, build_test_database_up, build_test_frontend, build_test_nginx] + needs: [build_test_mariadb, build_test_database_up, build_test_nginx] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -346,14 +248,7 @@ jobs: name: docker-database-test_up path: /tmp - name: Load Docker Image (Database Up) - run: docker load < /tmp/database_up.tar - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image (Frontend) - run: docker load < /tmp/frontend.tar + run: docker load < /tmp/database_up.tar - name: Download Docker Image (Nginx) uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/test_frontend.yml b/.github/workflows/test_frontend.yml new file mode 100644 index 000000000..6dd527079 --- /dev/null +++ b/.github/workflows/test_frontend.yml @@ -0,0 +1,84 @@ +name: Gradido Frontend Test CI + +on: push + +jobs: + # only (but most important) job from this workflow required for pull requests + # check results serve as run conditions for all other jobs here + files-changed: + name: Detect File Changes - Frontend + runs-on: ubuntu-latest + outputs: + frontend: ${{ steps.changes.outputs.frontend }} + steps: + - uses: actions/checkout@v3.3.0 + + - name: Check for frontend file changes + uses: dorny/paths-filter@v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + + + build_test: + if: needs.files-changed.outputs.frontend == 'true' + name: Docker Build Test - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Build 'test' image + run: docker build --target test -t "gradido/frontend:test" frontend/ --build-arg NODE_ENV="test" + + unit_test: + if: needs.files-changed.outputs.frontend == 'true' + name: Unit Tests - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Unit tests + run: cd frontend && yarn && yarn run test + + lint: + if: needs.files-changed.outputs.frontend == 'true' + name: Lint - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Lint + run: cd frontend && yarn && yarn run lint + + stylelint: + if: needs.files-changed.outputs.frontend == 'true' + name: Stylelint - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Stylelint + run: cd frontend && yarn && yarn run stylelint + + locales: + if: needs.files-changed.outputs.frontend == 'true' + name: Locales - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Locales + run: cd frontend && yarn && yarn run locales From fef4095aeafe42962a702c02c7379e4339ca4339 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 14 Mar 2023 20:04:05 +0100 Subject: [PATCH 03/17] separate e2e test workflowto own workflow file --- .github/workflows/e2e-test.yml | 58 ++++++++++++++++++++ .github/workflows/test.yml | 98 ---------------------------------- 2 files changed, 58 insertions(+), 98 deletions(-) create mode 100644 .github/workflows/e2e-test.yml diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml new file mode 100644 index 000000000..d1dd2851a --- /dev/null +++ b/.github/workflows/e2e-test.yml @@ -0,0 +1,58 @@ +name: Gradido End-to-End Test CI + +on: push + +jobs: + end-to-end-tests: + name: End-to-End Tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Boot up test system | docker-compose mariadb + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb + + - name: Boot up test system | docker-compose database + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database + + - name: Boot up test system | docker-compose backend + run: | + cd backend + cp .env.test_e2e .env + cd .. + docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend + + - name: Sleep for 10 seconds + run: sleep 10s + + - name: Boot up test system | seed backend + run: | + sudo chown runner:docker -R * + cd database + yarn && yarn dev_reset + cd ../backend + yarn && yarn seed + cd .. + + - name: Boot up test system | docker-compose frontends + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps frontend admin nginx + + - name: Boot up test system | docker-compose mailserver + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver + + - name: Sleep for 15 seconds + run: sleep 15s + + - name: End-to-end tests | run tests + id: e2e-tests + run: | + cd e2e-tests/ + yarn + yarn run cypress run + - name: End-to-end tests | if tests failed, upload screenshots + if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} + uses: actions/upload-artifact@v3 + with: + name: cypress-screenshots + path: /home/runner/work/gradido/gradido/e2e-tests/cypress/screenshots/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a9243af9..20f0c2e61 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -316,101 +316,3 @@ jobs: run: docker-compose -f docker-compose.yml run -T database yarn up - name: database | reset run: docker-compose -f docker-compose.yml run -T database yarn reset - - ############################################################################## - # JOB: END-TO-END TESTS ##################################################### - ############################################################################## - end-to-end-tests: - name: End-to-End Tests - runs-on: ubuntu-latest - needs: [build_test_mariadb, build_test_database_up, build_test_frontend, build_test_nginx] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Mariadb) - uses: actions/download-artifact@v3 - with: - name: docker-mariadb-test - path: /tmp - - name: Load Docker Image (Mariadb) - run: docker load < /tmp/mariadb.tar - - name: Download Docker Image (Database Up) - uses: actions/download-artifact@v3 - with: - name: docker-database-test_up - path: /tmp - - name: Load Docker Image (Database Up) - run: docker load < /tmp/database_up.tar - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image (Frontend) - run: docker load < /tmp/frontend.tar - - name: Download Docker Image (Nginx) - uses: actions/download-artifact@v3 - with: - name: docker-nginx-test - path: /tmp - - name: Load Docker Image (Nginx) - run: docker load < /tmp/nginx.tar - - ########################################################################## - # BOOT UP THE TEST SYSTEM ################################################ - ########################################################################## - - name: Boot up test system | docker-compose mariadb - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb - - - name: Boot up test system | docker-compose database - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - - - name: Boot up test system | docker-compose backend - run: | - cd backend - cp .env.test_e2e .env - cd .. - docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend - - - name: Sleep for 10 seconds - run: sleep 10s - - - name: Boot up test system | seed backend - run: | - sudo chown runner:docker -R * - cd database - yarn && yarn dev_reset - cd ../backend - yarn && yarn seed - cd .. - - - name: Boot up test system | docker-compose frontends - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps frontend admin nginx - - - name: Boot up test system | docker-compose mailserver - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver - - - name: Sleep for 15 seconds - run: sleep 15s - - ########################################################################## - # END-TO-END TESTS ####################################################### - ########################################################################## - - name: End-to-end tests | run tests - id: e2e-tests - run: | - cd e2e-tests/ - yarn - yarn run cypress run - - name: End-to-end tests | if tests failed, upload screenshots - if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} - uses: actions/upload-artifact@v3 - with: - name: cypress-screenshots - path: /home/runner/work/gradido/gradido/e2e-tests/cypress/screenshots/ From 03128f7f3d169f0ee117cffa7c4e4636de6b20d0 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 15 Mar 2023 13:44:22 +0100 Subject: [PATCH 04/17] add file filters to dht and federation workflows --- .github/file-filters.yml | 8 +++++++- .github/workflows/test_dht-node.yml | 24 ++++++++++++++++++++++++ .github/workflows/test_federation.yml | 24 ++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index f3ec61fc2..6e6ce1d5a 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -30,5 +30,11 @@ admin: &admin - 'admin/**/*' -frontend: &admin +dht_node: &dht_node + - 'dht-node/**/*' + +federation: &federation + - 'federation/**/*' + +frontend: &frontend - 'frontend/**/*' \ No newline at end of file diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index fbda230ee..2dec4717d 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -3,11 +3,31 @@ name: Gradido DHT Node Test CI on: push jobs: + # only (but most important) job from this workflow required for pull requests + # check results serve as run conditions for all other jobs here + files-changed: + name: Detect File Changes - DHT Node + runs-on: ubuntu-latest + outputs: + frontend: ${{ steps.changes.outputs.dht_node }} + steps: + - uses: actions/checkout@v3.3.0 + + - name: Check for frontend file changes + uses: dorny/paths-filter@v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + ############################################################################## # JOB: DOCKER BUILD TEST ##################################################### ############################################################################## build: name: Docker Build Test - DHT Node + if: needs.files-changed.outputs.dht_node == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code @@ -29,6 +49,8 @@ jobs: ############################################################################## lint: name: Lint - DHT Node + if: needs.files-changed.outputs.dht_node == 'true' + needs: files-changed runs-on: ubuntu-latest needs: [build] steps: @@ -51,6 +73,8 @@ jobs: ############################################################################## unit_test: name: Unit Tests - DHT Node + if: needs.files-changed.outputs.dht_node == 'true' + needs: files-changed runs-on: ubuntu-latest needs: [build] steps: diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index 7d92f1f84..5fb5bdab0 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -3,11 +3,31 @@ name: Gradido Federation Test CI on: push jobs: + # only (but most important) job from this workflow required for pull requests + # check results serve as run conditions for all other jobs here + files-changed: + name: Detect File Changes - Federation + runs-on: ubuntu-latest + outputs: + frontend: ${{ steps.changes.outputs.federation }} + steps: + - uses: actions/checkout@v3.3.0 + + - name: Check for frontend file changes + uses: dorny/paths-filter@v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + ############################################################################## # JOB: DOCKER BUILD TEST ##################################################### ############################################################################## build: name: Docker Build Test - Federation + if: needs.files-changed.outputs.federation == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code @@ -29,6 +49,8 @@ jobs: ############################################################################## lint: name: Lint - Federation + if: needs.files-changed.outputs.federation == 'true' + needs: files-changed runs-on: ubuntu-latest needs: [build] steps: @@ -51,6 +73,8 @@ jobs: ############################################################################## unit_test: name: Unit Tests - Federation + if: needs.files-changed.outputs.federation == 'true' + needs: files-changed runs-on: ubuntu-latest needs: [build] steps: From 796f571db0576890aab8860c5735afe4f1695f17 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 10:02:55 +0100 Subject: [PATCH 05/17] fix typo intest_dht-node.yml --- .github/workflows/test_dht-node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index 2dec4717d..5447bcdba 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -9,7 +9,7 @@ jobs: name: Detect File Changes - DHT Node runs-on: ubuntu-latest outputs: - frontend: ${{ steps.changes.outputs.dht_node }} + dht_node: ${{ steps.changes.outputs.dht_node }} steps: - uses: actions/checkout@v3.3.0 From 1697a24042b8254f0ae3062b49b01d3f05ef24be Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 10:04:35 +0100 Subject: [PATCH 06/17] fix typo intest_federation.yml --- .github/workflows/test_federation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index 5fb5bdab0..df93fecb7 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -9,7 +9,7 @@ jobs: name: Detect File Changes - Federation runs-on: ubuntu-latest outputs: - frontend: ${{ steps.changes.outputs.federation }} + federation: ${{ steps.changes.outputs.federation }} steps: - uses: actions/checkout@v3.3.0 From a4f71070ae2b2ab14dff1d27be866f3d72c6389a Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 10:52:26 +0100 Subject: [PATCH 07/17] add docker file filter for workflows --- .github/file-filters.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 6e6ce1d5a..2ae1bf9b4 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -33,6 +33,9 @@ admin: &admin dht_node: &dht_node - 'dht-node/**/*' +docker: &docker + - 'docker-compose.*' + federation: &federation - 'federation/**/*' From bc8960d3701f01da357a34b52cc8f3f6fc120996 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 10:53:43 +0100 Subject: [PATCH 08/17] add docker file filter conditon to dht node and federatio workflows --- .github/workflows/test_dht-node.yml | 5 +++-- .github/workflows/test_federation.yml | 13 +++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index 5447bcdba..2e45303ac 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest outputs: dht_node: ${{ steps.changes.outputs.dht_node }} + docker: ${{ steps.changes.outputs.docker }} steps: - uses: actions/checkout@v3.3.0 @@ -26,14 +27,14 @@ jobs: ############################################################################## build: name: Docker Build Test - DHT Node - if: needs.files-changed.outputs.dht_node == 'true' + if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker == 'true' needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - - name: Build `test` image + - name: Build 'test' image run: | docker build --target test -t "gradido/dht-node:test" -f dht-node/Dockerfile . docker save "gradido/dht-node:test" > /tmp/dht-node.tar diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index df93fecb7..678d33a2c 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -9,6 +9,7 @@ jobs: name: Detect File Changes - Federation runs-on: ubuntu-latest outputs: + docker: ${{ steps.changes.outputs.docker }} federation: ${{ steps.changes.outputs.federation }} steps: - uses: actions/checkout@v3.3.0 @@ -26,14 +27,14 @@ jobs: ############################################################################## build: name: Docker Build Test - Federation - if: needs.files-changed.outputs.federation == 'true' + if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.federation == 'true' needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - - name: Build `test` image + - name: Build 'test' image run: | docker build --target test -t "gradido/federation:test" -f federation/Dockerfile . docker save "gradido/federation:test" > /tmp/federation.tar @@ -56,14 +57,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - - name: Download Docker Image - uses: actions/download-artifact@v3 - with: - name: docker-federation-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/federation.tar - name: Lint run: docker run --rm gradido/federation:test yarn run lint From e851eb19afb79b84debf7a5b8b54f416cada871f Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 10:53:43 +0100 Subject: [PATCH 09/17] add docker file filter conditon to dht node and federatio workflows --- .github/workflows/test_dht-node.yml | 2 +- .github/workflows/test_federation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index 2e45303ac..fc10a5a44 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -74,7 +74,7 @@ jobs: ############################################################################## unit_test: name: Unit Tests - DHT Node - if: needs.files-changed.outputs.dht_node == 'true' + if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker == 'true' needs: files-changed runs-on: ubuntu-latest needs: [build] diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index 678d33a2c..f5e0f6631 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -66,7 +66,7 @@ jobs: ############################################################################## unit_test: name: Unit Tests - Federation - if: needs.files-changed.outputs.federation == 'true' + if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.federation == 'true' needs: files-changed runs-on: ubuntu-latest needs: [build] From 8b734ddc894da99a31a5cc5beb9f43f91044b8f6 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:06:21 +0100 Subject: [PATCH 10/17] remove docker build dependencies from dht node test workflow --- .github/workflows/test_dht-node.yml | 34 +++-------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index fc10a5a44..d3a92ccf0 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -35,15 +35,8 @@ jobs: uses: actions/checkout@v3 - name: Build 'test' image - run: | - docker build --target test -t "gradido/dht-node:test" -f dht-node/Dockerfile . - docker save "gradido/dht-node:test" > /tmp/dht-node.tar + run: docker build --target test -t "gradido/dht-node:test" -f dht-node/Dockerfile . - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: docker-dht-node-test - path: /tmp/dht-node.tar ############################################################################## # JOB: LINT ################################################################## @@ -53,21 +46,12 @@ jobs: if: needs.files-changed.outputs.dht_node == 'true' needs: files-changed runs-on: ubuntu-latest - needs: [build] steps: - name: Checkout code uses: actions/checkout@v3 - - - name: Download Docker Image - uses: actions/download-artifact@v3 - with: - name: docker-dht-node-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/dht-node.tar - name: Lint - run: docker run --rm gradido/dht-node:test yarn run lint + run: cd dht-node && yarn && yarn run lint ############################################################################## # JOB: UNIT TEST ############################################################# @@ -77,20 +61,10 @@ jobs: if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker == 'true' needs: files-changed runs-on: ubuntu-latest - needs: [build] steps: - name: Checkout code uses: actions/checkout@v3 - - name: Download Docker Image - uses: actions/download-artifact@v3 - with: - name: docker-dht-node-test - path: /tmp - - - name: Load Docker Image - run: docker load < /tmp/dht-node.tar - - name: docker-compose mariadb run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb @@ -105,7 +79,5 @@ jobs: run: sleep 30s shell: bash - #- name: Unit tests - # run: cd database && yarn && yarn build && cd ../dht-node && yarn && yarn test - name: Unit tests - run: docker run --env NODE_ENV=test --env DB_HOST=mariadb --network gradido_internal-net --rm gradido/dht-node:test yarn run test + run: cd dht-node && yarn && yarn test From 1c426db68d110547184a5188ef9b504280e0d18f Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:07:59 +0100 Subject: [PATCH 11/17] test dth node workflow without docker build dependencies --- dht-node/test/helpers.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dht-node/test/helpers.ts b/dht-node/test/helpers.ts index f298bed1c..4b5f773f7 100644 --- a/dht-node/test/helpers.ts +++ b/dht-node/test/helpers.ts @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +// TEST + import CONFIG from '@/config' import connection from '@/typeorm/connection' import { checkDBVersion } from '@/typeorm/DBVersion' From 1c31a5b6797a1d6eaea79df90ff1e8f25ef2ea4c Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:31:16 +0100 Subject: [PATCH 12/17] undo docker build dependencies removal for dht node unit tests --- .github/workflows/test_dht-node.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index d3a92ccf0..2f533615c 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -35,8 +35,15 @@ jobs: uses: actions/checkout@v3 - name: Build 'test' image - run: docker build --target test -t "gradido/dht-node:test" -f dht-node/Dockerfile . + run: | + docker build --target test -t "gradido/dht-node:test" -f dht-node/Dockerfile . + docker save "gradido/dht-node:test" > /tmp/dht-node.tar + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: docker-dht-node-test + path: /tmp/dht-node.tar ############################################################################## # JOB: LINT ################################################################## @@ -61,10 +68,20 @@ jobs: if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker == 'true' needs: files-changed runs-on: ubuntu-latest + needs: [build] steps: - name: Checkout code uses: actions/checkout@v3 + - name: Download Docker Image + uses: actions/download-artifact@v3 + with: + name: docker-dht-node-test + path: /tmp + + - name: Load Docker Image + run: docker load < /tmp/dht-node.tar + - name: docker-compose mariadb run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb @@ -79,5 +96,7 @@ jobs: run: sleep 30s shell: bash + #- name: Unit tests + # run: cd database && yarn && yarn build && cd ../dht-node && yarn && yarn test - name: Unit tests - run: cd dht-node && yarn && yarn test + run: docker run --env NODE_ENV=test --env DB_HOST=mariadb --network gradido_internal-net --rm gradido/dht-node:test yarn run test From 48efa927f5d115f6346c0e2e44a9ea74beb2159a Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:31:55 +0100 Subject: [PATCH 13/17] test dth node workflow without docker build dependencies --- dht-node/test/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dht-node/test/helpers.ts b/dht-node/test/helpers.ts index 4b5f773f7..57796b97b 100644 --- a/dht-node/test/helpers.ts +++ b/dht-node/test/helpers.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -// TEST +// TESTS import CONFIG from '@/config' import connection from '@/typeorm/connection' From fb45ec3346643ca92eadb25c4a4f2a523178db86 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:39:11 +0100 Subject: [PATCH 14/17] fix typo --- .github/workflows/test_dht-node.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index 2f533615c..a57f09399 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -66,9 +66,8 @@ jobs: unit_test: name: Unit Tests - DHT Node if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker == 'true' - needs: files-changed + needs: [files-changed, build] runs-on: ubuntu-latest - needs: [build] steps: - name: Checkout code uses: actions/checkout@v3 From 286bbbbbd22cd2a2b1b6cdfe2dbd06727cad5ff8 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:40:20 +0100 Subject: [PATCH 15/17] test dth node workflow --- dht-node/test/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dht-node/test/helpers.ts b/dht-node/test/helpers.ts index 57796b97b..25aac98d0 100644 --- a/dht-node/test/helpers.ts +++ b/dht-node/test/helpers.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -// TESTS +// TESTING import CONFIG from '@/config' import connection from '@/typeorm/connection' From 7f17bc69d206fb513b37db849356bdf861339acb Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:55:43 +0100 Subject: [PATCH 16/17] remove testing comment from dht node helpers file --- dht-node/test/helpers.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/dht-node/test/helpers.ts b/dht-node/test/helpers.ts index 25aac98d0..f298bed1c 100644 --- a/dht-node/test/helpers.ts +++ b/dht-node/test/helpers.ts @@ -1,8 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -// TESTING - import CONFIG from '@/config' import connection from '@/typeorm/connection' import { checkDBVersion } from '@/typeorm/DBVersion' From 82ec5eea7022bf4a9bb34e0cc6f164a0b6bc531b Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 16 Mar 2023 11:57:53 +0100 Subject: [PATCH 17/17] remove docker build dependency from dht node linting job --- .github/workflows/test_federation.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index f5e0f6631..fc29a1bf8 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -34,7 +34,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Build 'test' image + - name: Build `test` image run: | docker build --target test -t "gradido/federation:test" -f federation/Dockerfile . docker save "gradido/federation:test" > /tmp/federation.tar @@ -53,13 +53,12 @@ jobs: if: needs.files-changed.outputs.federation == 'true' needs: files-changed runs-on: ubuntu-latest - needs: [build] steps: - name: Checkout code uses: actions/checkout@v3 - name: Lint - run: docker run --rm gradido/federation:test yarn run lint + run: cd federation && yarn && yarn run lint ############################################################################## # JOB: UNIT TEST ############################################################# @@ -67,9 +66,8 @@ jobs: unit_test: name: Unit Tests - Federation if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.federation == 'true' - needs: files-changed + needs: [files-changed, build] runs-on: ubuntu-latest - needs: [build] steps: - name: Checkout code uses: actions/checkout@v3