3
0

Optimize test workflow with caching yarn dependencies for libs and docker images.

This commit is contained in:
Kelani Tolulope 2024-01-17 12:15:12 +01:00
parent d614a00c27
commit 459140ea0f
2 changed files with 25 additions and 28 deletions

View File

@ -3,7 +3,7 @@ version: "3.5"
services:
backend:
network_mode: host
image: golang:latest
image: golang:${GO_VERSION}
volumes:
- "${PWD}:/corteza"
entrypoint: |

View File

@ -95,6 +95,22 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref_name }}
- name: Clone CY repo
uses: actions/checkout@v3
with:
repository: cortezaproject/corteza-e2e-cypress
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref_name }}
path: corteza-e2e-cypress
- name: Cache lib dependencies
uses: actions/cache@v3
with:
path: |
corteza/lib/vue/node_modules
corteza/lib/js/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('corteza/lib/vue/yarn.lock', 'corteza/lib/js/yarn.lock') }}
- name: Copy server language files
working-directory: corteza/server/pkg/locale
run: make src/en
@ -108,6 +124,14 @@ jobs:
cp .github/workflows/assets/client/vue.config-builder.js client/web/${CLIENT_NAME}/public/vue.config-builder.js
cp .github/workflows/assets/client/config.js client/web/${CLIENT_NAME}/public/config.js
docker-compose config > /tmp/docker-compose.corteza.yaml
cd ../corteza-e2e-cypress && docker-compose config > /tmp/docker-compose.corteza-e2e.yaml
- name: Cache Docker images
uses: ScribeMD/docker-cache@0.3.7
with:
key: docker-${{ runner.os }}-${{ hashFiles('/tmp/docker-compose.corteza.yaml', '/tmp/docker-compose.corteza-e2e.yaml') }}
- name: Run server and db
working-directory: corteza
run: |
@ -146,14 +170,6 @@ jobs:
yarn install && \
yarn serve --port ${CLIENT_PORT}"
- name: Clone CY repo
uses: actions/checkout@v3
with:
repository: cortezaproject/corteza-e2e-cypress
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref_name }}
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 postgres | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done'
@ -223,22 +239,3 @@ jobs:
🔗 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/
📷 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/screenshots/${{ env.SCREENSHOTS_GEN_FOLDER }}/
notify-success:
needs: [ server-client-setup ]
runs-on: ubuntu-20.04
if: success()
steps:
- name: Send message on successful testing results
uses: fadenb/matrix-chat-message@v0.0.6
env:
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }}
E2E_REPORTS_PASS: ${{ secrets.E2E_REPORTS_PASS }}
with:
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
channel: ${{ secrets.MATRIX_ROOM_ID }}
message: |
✅ E2e tests passed 🙌 🎉
🔗 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/