Skip to content

Commit d75a7d7

Browse files
authored
devops(docker): add docker test bot (#357)
1 parent d2b6e1c commit d75a7d7

File tree

5 files changed

+112
-1
lines changed

5 files changed

+112
-1
lines changed

.github/workflows/test_docker.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test Docker
2+
on:
3+
push:
4+
paths:
5+
- '.github/workflows/test_docker.yml'
6+
- 'Dockerfile*'
7+
branches:
8+
- master
9+
- release-*
10+
pull_request:
11+
paths:
12+
- '.github/workflows/test_docker.yml'
13+
- 'Dockerfile*'
14+
branches:
15+
- master
16+
- release-*
17+
jobs:
18+
test:
19+
timeout-minutes: 60
20+
runs-on: ubuntu-20.04
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Build Docker image
24+
run: docker build -t playwright-java:localbuild-focal -f Dockerfile.focal .
25+
- name: Test
26+
run: |
27+
CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-focal /bin/bash)"
28+
docker exec "${CONTAINER_ID}" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh

Dockerfile.focal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,6 @@ COPY . /tmp/pw-java
136136
RUN cd /tmp/pw-java && \
137137
./scripts/download_driver_for_all_platforms.sh && \
138138
mvn install -D skipTests --no-transfer-progress && \
139-
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install" -f playwright/pom.xml && \
139+
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
140+
-D exec.args="install" -f playwright/pom.xml --no-transfer-progress && \
140141
rm -rf /tmp/pw-java
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set +x
5+
6+
trap "cd $(pwd -P)" EXIT
7+
cd "$(dirname $0)"
8+
9+
10+
PROJECT_DIR=$(mktemp -d)
11+
echo "Creating project in $PROJECT_DIR"
12+
cp -R . $PROJECT_DIR
13+
cp -R ../../driver-bundle/src/test/ $PROJECT_DIR/src/
14+
cp -R ../../playwright/src/test/ $PROJECT_DIR/src/
15+
cd $PROJECT_DIR
16+
17+
mvn test --no-transfer-progress
18+
19+
rm -rf $PROJECT_DIR
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.microsoft.playwright</groupId>
6+
<artifactId>test-local-installation</artifactId>
7+
<version>1.10.0-SNAPSHOT</version>
8+
<name>Test local installation</name>
9+
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
10+
<properties>
11+
<compiler.version>1.8</compiler.version>
12+
<gson.version>2.8.6</gson.version>
13+
<junit.version>5.7.0</junit.version>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<websocket.version>1.5.1</websocket.version>
16+
</properties>
17+
<dependencies>
18+
<dependency>
19+
<groupId>com.microsoft.playwright</groupId>
20+
<artifactId>playwright</artifactId>
21+
<version>${project.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>com.google.code.gson</groupId>
25+
<artifactId>gson</artifactId>
26+
<version>${gson.version}</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.junit.jupiter</groupId>
30+
<artifactId>junit-jupiter-engine</artifactId>
31+
<version>${junit.version}</version>
32+
<scope>test</scope>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.java-websocket</groupId>
36+
<artifactId>Java-WebSocket</artifactId>
37+
<version>${websocket.version}</version>
38+
</dependency>
39+
</dependencies>
40+
<build>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.apache.maven.plugins</groupId>
44+
<artifactId>maven-compiler-plugin</artifactId>
45+
<version>3.1</version>
46+
<configuration>
47+
<source>${compiler.version}</source>
48+
<target>${compiler.version}</target>
49+
</configuration>
50+
</plugin>
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-surefire-plugin</artifactId>
54+
<version>3.0.0-M5</version>
55+
<configuration>
56+
<redirectTestOutputToFile>true</redirectTestOutputToFile>
57+
</configuration>
58+
</plugin>
59+
</plugins>
60+
</build>
61+
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This derictory is populated with test files from playwright and playwright-driver projects. They are copied
2+
here on each test run.

0 commit comments

Comments
 (0)