Workflow file for this run
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
name: "E2e test on main branch push" | |
# These jobs can be tested with nektos/act tool | |
# https://github.com/nektos/act | |
# | |
# Look for "!env.ACT" in the DRY_RUN expression below | |
on: | |
push: | |
branches: | |
- 2023.9.x-feature-e2e | |
env: | |
BUILD_OS: linux | |
BUILD_ARCH: amd64 | |
GO_VERSION: 1.19 | |
GOFLAGS: -mod=readonly | |
NODE_VERSION: 16 | |
CORTEZA_VERSION: 2023.3.8 | |
CYPRESS_VERSION: 9.5.1 | |
CYPRESS_HOST: http://backend | |
CYPRESS_BASE_URL: http://backend | |
CYPRESS_ADMIN_URL: http://admin:8080 | |
CYPRESS_COMPOSE_URL: http://compose:8080 | |
CYPRESS_WORKFLOW_URL: http://workflow:8080 | |
CYPRESS_REPORTER_URL: http://localhost:8084 | |
CYPRESS_ONE_URL: http://localhost:8085 | |
CYPRESS_PRIVACY_URL: http://localhost:8086 | |
CYPRESS_USER_EMAIL: [email protected] | |
CYPRESS_USER_PASSWORD: cypress123 | |
CYPRESS_USER_PASSWORD_NEW: newcypress123 | |
CYPRESS_USER_EMAIL_NEW: [email protected] | |
CYPRESS_USER_DPO: [email protected] | |
CYPRESS_USER_DPO_PASSWORD: [email protected] | |
jobs: | |
server-client-setup: | |
name: "server and client test" | |
strategy: | |
matrix: | |
client: [admin, compose, reporter, workflow] | |
# test: [ admin, compose, topbar, reporter, workflow, server] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
limit-access-to-actor: true | |
detached: true | |
- uses: actions/setup-node@v3 | |
with: { node-version: "${{ env.NODE_VERSION }}" } | |
- uses: actions/setup-go@v3 | |
with: { go-version: "${{ env.GO_VERSION }}" } | |
- name: "Setup YARN" | |
run: npm install -g yarn @vue/cli-service | |
- name: Checkout corteza repo | |
uses: actions/checkout@v3 | |
with: | |
path: corteza | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: 2023.9.x-feature-e2e | |
- name: "Copy server language files" | |
working-directory: corteza/server/pkg/locale | |
run: make src/en | |
- name: Run server and db | |
working-directory: corteza | |
run: | | |
docker-compose up -d backend | |
docker-compose up -d postgres | |
- name: Update config file in webapps | |
working-directory: corteza | |
env: | |
CLIENT_NAME: ${{ matrix.client }} | |
run: | | |
cp client/web/${CLIENT_NAME}/public/config.example.js client/web/${CLIENT_NAME}/public/config.js | |
sed -i -e 's/https:\/\/api.cortezaproject.your-domain.tld/\/\/backend\/api/g' client/web/${CLIENT_NAME}/public/config.js | |
- name: Build js | |
working-directory: corteza/lib/js | |
run: | | |
yarn install | |
yarn build | |
- name: Build vue | |
working-directory: corteza/lib/vue | |
run: | | |
yarn install | |
yarn build | |
- name: Run "${{ matrix.client }}" | |
working-directory: corteza | |
# re-link the packages for each app | |
env: | |
CLIENT_NAME: ${{ matrix.client }} | |
run: | | |
echo ${CLIENT_NAME} | |
docker-compose run -d \ | |
--name ${CLIENT_NAME} \ | |
--use-aliases \ | |
client \ | |
sh -c "cd /corteza/lib/js && yarn link && cd /corteza/lib/vue && yarn link && cd /corteza/client/web/${CLIENT_NAME} && yarn link @cortezaproject/corteza-vue && yarn link @cortezaproject/corteza-js && yarn install && yarn serve" | |
- name: Clone CY repo | |
uses: actions/checkout@v3 | |
with: | |
repository: cortezaproject/corteza-e2e-cypress | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: 2023.9.x-feature-e2e | |
path: corteza-e2e-cypress | |
# github actions do not support docker-compose --wait | |
- name: Wait for postgres healthcheck | |
run: timeout 180s sh -c 'until docker ps | grep corteza_postgres_1 | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done' | |
- name: Wait for "${{ matrix.client }}" healthcheck | |
env: | |
CLIENT_NAME: ${{ matrix.client }} | |
run: timeout 180s sh -c 'until docker ps | grep ${CLIENT_NAME} | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done' | |
- name: Wait for backend healthcheck | |
run: timeout 180s sh -c 'until docker ps | grep corteza_backend_1 | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done' | |
- name: Run CY tests for "admin" | |
env: | |
CLIENT_NAME: ${{ matrix.client }} | |
COMMAND: cypress run --spec cypress/integration/basic-functionalities/${{ matrix.client }}/index.js --browser chrome | |
working-directory: corteza-e2e-cypress | |
run: | | |
docker ps | |
yarn install | |
echo "${CLIENT_NAME}" | |
docker-compose run \ | |
--entrypoint="${COMMAND}" \ | |
cypress | |
docker-compose run \ | |
--entrypoint='' \ | |
cypress | |
# - name: Run Compose CY tests | |
# working-directory: corteza-e2e-cypress | |
# if: matrix.client == 'compose' | |
# run: | | |
# docker ps | |
# yarn install | |
# docker-compose run \ | |
# --name cypress \ | |
# --use-aliases \ | |
# --entrypoint='cypress run | |
# --spec cypress/integration/basic-functionalities/server/Create_user.spec.js | |
# --browser chrome' \ | |
# cypress | |
# docker-compose run \ | |
# --name cypress \ | |
# --use-aliases \ | |
# --entrypoint='cypress run | |
# --spec cypress/integration/basic-functionalities/compose/index.js | |
# --browser chrome' \ | |
# cypress | |
# client-web-test: | |
# name: "Web client test (${{ matrix.app }})" | |
# runs-on: ubuntu-20.04 | |
# strategy: | |
# matrix: { app: [ admin, compose, discovery, privacy, reporter, one, workflow ] } | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/setup-node@v3 | |
# with: { node-version: "${{ env.NODE_VERSION }}" } | |
# - name: "Setup YARN" | |
# working-directory: client/web/${{ matrix.app }} | |
# run: npm install -g yarn @vue/cli-service | |
# - name: "Cache" | |
# uses: actions/cache@v3 | |
# if: ${{ !env.ACT }} | |
# with: | |
# path: ~/.npm | |
# key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: ${{ runner.OS }}-node- | |
# - name: "Dependencies" | |
# working-directory: client/web/${{ matrix.app }} | |
# run: make dep | |
# - name: "Tests" | |
# working-directory: client/web/${{ matrix.app }} | |
# run: make test | |
# | |
# server-test: | |
# name: "Server tests" | |
# runs-on: ubuntu-20.04 | |
# env: | |
# GOFLAGS: -mod=readonly | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/setup-go@v3 | |
# with: { go-version: "${{ env.GO_VERSION }}" } | |
# - name: "Copy language files" | |
# working-directory: server/pkg/locale | |
# run: make src/en | |
# - name: "Unit" | |
# working-directory: server | |
# run: make test.unit | |
# - name: "Store" | |
# working-directory: server | |
# run: make test.store | |
# - name: "Integration" | |
# working-directory: server | |
# run: make test.integration | |
# | |
# notify: | |
# if: failure() | |
# name: "Send matrix testing notification" | |
# runs-on: ubuntu-20.04 | |
# needs: [ server-test, client-web-test, lib-test ] | |
# steps: | |
# - name: "Send message via Matrix on failed tests" | |
# if: ${{ !env.ACT && failure() }} | |
# id: matrix-chat-tests-failed | |
# uses: fadenb/[email protected] | |
# with: | |
# homeserver: ${{ secrets.MATRIX_HOME_SERVER }} | |
# token: ${{ secrets.MATRIX_ACCESS_TOKEN }} | |
# channel: ${{ secrets.MATRIX_ROOM_ID }} |