Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/assets/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.5"
services:
backend:
network_mode: host
image: golang:latest
image: golang:${GO_VERSION}
volumes:
- "${PWD}:/corteza"
entrypoint: |
Expand Down
51 changes: 24 additions & 27 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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/
Loading