Skip to content

Commit

Permalink
Merge pull request #890 from intuitem/ci_experiments
Browse files Browse the repository at this point in the history
CI Playwright improvements
  • Loading branch information
monsieurswag authored Oct 9, 2024
2 parents 6550815 + dad46cc commit f27d29c
Show file tree
Hide file tree
Showing 7 changed files with 2,735 additions and 2,425 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
enterprise-frontend-directory: ./enterprise/frontend
enterprise-frontend-build-directory: ./enterprise/frontend/.build/frontend
enterprise-backend-settings-module: enterprise_core.settings
DEBUG: pw:webserver

jobs:
functional-tests:
Expand Down Expand Up @@ -60,7 +61,7 @@ jobs:
pnpm i --frozen-lockfile
- name: Install Playwright browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.frontend-directory }}
run: npx playwright install --with-deps ${{ matrix.playwright-browser }}
run: pnpm exec playwright install --with-deps ${{ matrix.playwright-browser }}
- name: Create frontend environment variables file
working-directory: ${{ env.frontend-directory }}
run: |
Expand Down Expand Up @@ -97,9 +98,12 @@ jobs:
export $(grep -v '^#' .env | xargs)
python manage.py createsuperuser --noinput
nohup python manage.py runserver &
- name: Build frontend
working-directory: ${{ env.frontend-directory }}
run: pnpm run build
- name: Run tests with browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.frontend-directory }}
run: npx playwright test --project=${{ matrix.playwright-browser }}
run: pnpm exec playwright test --project=${{ matrix.playwright-browser }}
env:
CI: true
- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -154,12 +158,12 @@ jobs:
- name: Install enterprise backend
working-directory: ${{ env.enterprise-backend-directory }}
run: poetry install
- name: Install frontend dependencies
- name: Build enterprise frontend
working-directory: ${{ env.enterprise-frontend-directory }}
run: make pre-build
- name: Install Playwright Browsers
run: make
- name: Install Playwright browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: npx playwright install --with-deps
run: pnpm exec playwright install --with-deps ${{ matrix.playwright-browser }}
- name: Create frontend environment variables file
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: |
Expand Down Expand Up @@ -197,7 +201,7 @@ jobs:
nohup poetry run python manage.py runserver --settings=${{ env.enterprise-backend-settings-module }} &
- name: Run tests with browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: npx playwright test --project=${{ matrix.playwright-browser }}
run: pnpm exec playwright test --project=${{ matrix.playwright-browser }}
env:
CI: true
- uses: actions/upload-artifact@v4
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/startup-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
pnpm i --frozen-lockfile
- name: Install Playwright Browsers
working-directory: ${{ env.frontend-directory }}
run: npx playwright install --with-deps
run: pnpm exec playwright install
- name: Create frontend environment variables file
working-directory: ${{ env.frontend-directory }}
run: |
Expand Down Expand Up @@ -87,9 +87,12 @@ jobs:
export $(grep -v '^#' .env | xargs)
poetry run python manage.py createsuperuser --noinput
nohup poetry run python manage.py runserver &
- name: Build frontend
working-directory: ${{ env.frontend-directory }}
run: pnpm run build
- name: Run tests
working-directory: ${{ env.frontend-directory }}
run: npx playwright test tests/functional/startup.test.ts
run: pnpm exec playwright test tests/functional/startup.test.ts
- uses: actions/upload-artifact@v4
if: always()
with:
Expand All @@ -114,7 +117,7 @@ jobs:
pnpm i --frozen-lockfile
- name: Install Playwright Browsers
working-directory: ${{ env.frontend-directory }}
run: npx playwright install --with-deps
run: pnpm exec playwright install
- name: Build the Docker app
run: docker compose -f docker-compose-build.yml up -d
- name: Create backend environment variables file
Expand Down Expand Up @@ -178,12 +181,12 @@ jobs:
- name: Install enterprise backend
working-directory: ${{ env.enterprise-backend-directory }}
run: poetry install
- name: Install frontend dependencies
- name: Build enterprise frontend
working-directory: ${{ env.enterprise-frontend-directory }}
run: make pre-build
run: make
- name: Install Playwright Browsers
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: npx playwright install --with-deps
run: pnpm exec playwright install
- name: Create frontend environment variables file
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: |
Expand Down Expand Up @@ -216,7 +219,7 @@ jobs:
nohup poetry run python manage.py runserver --settings=${{ env.enterprise-backend-settings-module }} &
- name: Run tests
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: npx playwright test tests/functional/startup.test.ts
run: pnpm exec playwright test tests/functional/startup.test.ts
- uses: actions/upload-artifact@v4
if: always()
with:
Expand All @@ -239,7 +242,7 @@ jobs:
run: make pre-build
- name: Install Playwright Browsers
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: npx playwright install --with-deps
run: pnpm exec playwright install
- name: Build the Docker app
run: docker compose -f enterprise/docker-compose-build.yml up -d
- name: Create backend environment variables file
Expand Down
6 changes: 3 additions & 3 deletions enterprise/frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pre-build: ensure-pnpm

build-enterprise: pre-build
@$(PM) run -C $(FRONTEND_DIR) build
@mv $(FRONTEND_DIR)/build $(ENTERPRISE_DIR)/build
@mv $(FRONTEND_DIR)/node_modules $(ENTERPRISE_DIR)/node_modules
@mv $(FRONTEND_DIR)/package.json $(ENTERPRISE_DIR)/package.json
@rsync -av $(FRONTEND_DIR)/build $(ENTERPRISE_DIR)/build
@rsync -av $(FRONTEND_DIR)/node_modules $(ENTERPRISE_DIR)/node_modules
@rsync -av $(FRONTEND_DIR)/package.json $(ENTERPRISE_DIR)/package.json

CHANGED_FILES =

Expand Down
Loading

0 comments on commit f27d29c

Please sign in to comment.