-
Notifications
You must be signed in to change notification settings - Fork 10
152 lines (128 loc) · 5.67 KB
/
Copy pathe2e.yml
File metadata and controls
152 lines (128 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
on:
workflow_call:
inputs:
image-tag-override:
type: string
env:
CI: true
jobs:
integration-tests:
name: Integration tests
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
strategy:
matrix:
package:
- core
# 20260106: disable for now in order to merge in gigantic PRs
# - context-editor
env:
ENV_FILE: .env.docker-compose.dev
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 22.13.1
- uses: pnpm/action-setup@v5
name: Install pnpm
with:
run_install: false
- name: Get pnpm store directory
id: get-store-path
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.get-store-path.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup turbo cache
uses: actions/cache/restore@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Get image tag
id: gettag
run: |
if [ -n "${{ inputs.image-tag-override }}" ]; then
echo "tag=${{ inputs.image-tag-override }}" >> $GITHUB_OUTPUT
echo "Using override image tag: ${{ inputs.image-tag-override }}"
else
echo "tag=$(git describe --always --abbrev=40 --dirty)" >> $GITHUB_OUTPUT
echo "Using current SHA as image tag"
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image refs
id: label
env:
IMAGE_TAG: ${{ steps.gettag.outputs.tag }}
run: |
echo "core_label=ghcr.io/knowledgefutures/platform:$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "jobs_label=ghcr.io/knowledgefutures/platform-jobs:$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "site_builder_label=ghcr.io/knowledgefutures/platform-site-builder:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Start up db images
run: pnpm test:setup
- name: p:build
run: pnpm p:build
- name: Run migrations and seed
run: pnpm --filter core reset-base
env:
MINIMAL_SEED: true
SKIP_VALIDATION: true
- run: pnpm --filter core exec playwright install --with-deps
- name: Start up core etc
run: pnpm integration:setup
env:
INTEGRATION_TESTS_IMAGE: ${{ steps.label.outputs.core_label }}
JOBS_IMAGE: ${{ steps.label.outputs.jobs_label }}
SITE_BUILDER_IMAGE: ${{ steps.label.outputs.site_builder_label }}
- name: Log out Container ID for health check
id: log-container-id
run: echo "CONTAINER_ID=$(docker compose -f docker-compose.test.yml ps integration-tests -q)" >> $GITHUB_OUTPUT
- name: Wait until container is healthy
run: while [ "`docker inspect -f {{.State.Health.Status}} ${{ steps.log-container-id.outputs.CONTAINER_ID }}`" != "healthy" ]; do sleep .2; done
- name: Run integration tests
run: pnpm playwright:test --filter ${{ matrix.package }} --env-mode=loose
env:
NODE_ENV: test
INTEGRATION_TEST_HOST: localhost
DATABASE_URL: postgresql://postgres:postgres@localhost:54322/postgres
- name: Print container logs
if: ${{ failure() || cancelled() }}
run: docker compose -f docker-compose.test.yml --profile integration logs -t
env:
INTEGRATION_TESTS_IMAGE: ${{steps.label.outputs.core_label}}
JOBS_IMAGE: ${{steps.label.outputs.jobs_label}}
SITE_BUILDER_IMAGE: ${{steps.label.outputs.site_builder_label}}
- name: Upload core playwright snapshots artifact
if: failure() && matrix.package == 'core'
uses: actions/upload-artifact@v4
with:
name: playwright-snapshots
path: core/test-results
retention-days: 10
- name: Upload context-editor playwright snapshots artifact
if: failure() && matrix.package == 'context-editor'
uses: actions/upload-artifact@v4
with:
name: playwright-snapshots
path: packages/context-editor/test-results
retention-days: 10