Compare commits
1 Commits
2c42e95265
...
t3chguy/ca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d82dc2e06 |
15
.github/workflows/end-to-end-tests.yaml
vendored
15
.github/workflows/end-to-end-tests.yaml
vendored
@@ -48,6 +48,7 @@ jobs:
|
||||
outputs:
|
||||
num-runners: ${{ env.NUM_RUNNERS }}
|
||||
runners-matrix: ${{ steps.runner-vars.outputs.matrix }}
|
||||
docker-cache-key: ${{ steps.runner-vars.outputs.docker-cache-key }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -80,6 +81,12 @@ jobs:
|
||||
run: |
|
||||
yarn build
|
||||
|
||||
# Heuristic for calculating a cache key which is based on all images we pass to testcontainers
|
||||
- name: Calculate docker cache key
|
||||
run: |
|
||||
grep -hr "Container(\"" --exclude-dir=snapshots --exclude-dir=sample-files playwright >> _docker_cache_key
|
||||
grep -hr -C1 "super(" playwright/testcontainers/ >> _docker_cache_key
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -90,11 +97,14 @@ jobs:
|
||||
- name: Calculate runner variables
|
||||
id: runner-vars
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
DOCKER_CACHE_KEY: ${{ hashFiles('_docker_cache_key') }}
|
||||
with:
|
||||
script: |
|
||||
const numRunners = parseInt(process.env.NUM_RUNNERS, 10);
|
||||
const matrix = Array.from({ length: numRunners }, (_, i) => i + 1);
|
||||
core.setOutput("matrix", JSON.stringify(matrix));
|
||||
core.setOutput("docker-cache-key", process.env.DOCKER_CACHE_KEY);
|
||||
|
||||
playwright:
|
||||
name: "Run Tests [${{ matrix.project }}] ${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}"
|
||||
@@ -164,6 +174,11 @@ jobs:
|
||||
if: matrix.project == 'WebKit' && steps.playwright-cache.outputs.cache-hit == 'true'
|
||||
run: yarn playwright install-deps webkit
|
||||
|
||||
- name: Docker image cache
|
||||
uses: ScribeMD/docker-cache@fb28c93772363301b8d0a6072ce850224b73f74e # 0.5.0
|
||||
with:
|
||||
key: ${{ needs.build.outputs.docker-cache-key }}
|
||||
|
||||
# We skip tests tagged with @mergequeue when running on PRs, but run them in MQ and everywhere else
|
||||
- name: Run Playwright tests
|
||||
run: |
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
docker pull "$IMAGE"
|
||||
INSPECT=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
|
||||
DIGEST=${INSPECT#*@}
|
||||
sed -i "s/const TAG.*/const TAG = \"develop@$DIGEST\";/" playwright/testcontainers/synapse.ts
|
||||
sed -i "s,`$IMAGE.*`,`$IMAGE@$DIGEST`," playwright/testcontainers/synapse.ts
|
||||
env:
|
||||
IMAGE: ghcr.io/element-hq/synapse:develop
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export const test = base.extend<{}, Services>({
|
||||
],
|
||||
postgres: [
|
||||
async ({ logger, network }, use) => {
|
||||
const container = await new PostgreSqlContainer()
|
||||
const container = await new PostgreSqlContainer("postgres:13.3-alpine")
|
||||
.withNetwork(network)
|
||||
.withNetworkAliases("postgres")
|
||||
.withLogConsumer(logger.getConsumer("postgres"))
|
||||
|
||||
@@ -17,8 +17,6 @@ import { Credentials } from "../plugins/homeserver";
|
||||
import { deepCopy } from "../plugins/utils/object.ts";
|
||||
import { HomeserverContainer, StartedHomeserverContainer } from "./HomeserverContainer.ts";
|
||||
|
||||
const TAG = "develop@sha256:b69222d98abe9625d46f5d3cb01683d5dc173ae339215297138392cfeec935d9";
|
||||
|
||||
const DEFAULT_CONFIG = {
|
||||
server_name: "localhost",
|
||||
public_baseurl: "", // set by start method
|
||||
@@ -144,7 +142,9 @@ export class SynapseContainer extends GenericContainer implements HomeserverCont
|
||||
private config: typeof DEFAULT_CONFIG;
|
||||
|
||||
constructor() {
|
||||
super(`ghcr.io/element-hq/synapse:${TAG}`);
|
||||
super(
|
||||
`ghcr.io/element-hq/synapse:develop@sha256:b69222d98abe9625d46f5d3cb01683d5dc173ae339215297138392cfeec935d9`,
|
||||
);
|
||||
|
||||
this.config = deepCopy(DEFAULT_CONFIG);
|
||||
this.config.registration_shared_secret = randB64Bytes(16);
|
||||
|
||||
Reference in New Issue
Block a user