Skip to content

Commit

Permalink
Merge branch 'main' of github.com:opendocument-app/OpenDocument.core …
Browse files Browse the repository at this point in the history
…into refactor/document-tree
  • Loading branch information
andiwand committed Nov 26, 2023
2 parents c644aca + 333bdfe commit 775911a
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 4 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: docker

on:
push:
branches:
- main
pull_request:

jobs:
test_image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT_ANDIWAND }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/odr_core_test
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha
- name: Build and push
uses: docker/build-push-action@v5
with:
context: test/docker
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/odr_core_test:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/odr_core_test:buildcache,mode=max

# TODO try to run it
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
## OpenDocument.core
build/
cmake-build-*/
venv/

*.zip
*.svg
Expand Down
71 changes: 71 additions & 0 deletions test/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
FROM ubuntu:22.04

ENV FIREFOX_VERSION="120.0"
ENV CHROME_VERSION="119.0.6045.159-1"
ENV PHANTOMJS_VERSION="2.1.1"
ENV GECKODRIVER_VERSION="0.33.0"
ENV CHROMEDRIVER_VERSION="119.0.6045.105"

ENV INSTALL="apt-get install -y --no-install-recommends"

RUN apt-get update

# install download and unpack utilities
RUN $INSTALL wget ca-certificates bzip2 unzip

# firefox setup
RUN $INSTALL libgtk-3-0 libasound2 libx11-xcb1

RUN wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2
RUN tar -xf firefox-${FIREFOX_VERSION}.tar.bz2
RUN mv firefox /usr/local/share
RUN ln -s /usr/local/share/firefox/firefox /usr/local/bin
RUN rm firefox-${FIREFOX_VERSION}.tar.bz2

RUN firefox --version

# geckodriver setup
RUN wget https://github.com/mozilla/geckodriver/releases/download/v${GECKODRIVER_VERSION}/geckodriver-v${GECKODRIVER_VERSION}-linux64.tar.gz
RUN tar -xf geckodriver-v${GECKODRIVER_VERSION}-linux64.tar.gz
RUN mv geckodriver /usr/local/bin
RUN rm geckodriver-v${GECKODRIVER_VERSION}-linux64.tar.gz

RUN geckodriver --version

# chrome setup
RUN wget https://dl.google.com/linux/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
RUN $INSTALL ./google-chrome-stable_${CHROME_VERSION}_amd64.deb
RUN rm google-chrome-stable_${CHROME_VERSION}_amd64.deb

RUN google-chrome --version

# chromedirver setup
RUN wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip
RUN unzip chromedriver-linux64.zip
RUN mv chromedriver-linux64/chromedriver /usr/local/bin
RUN rm -rf chromedriver-linux64
RUN rm chromedriver-linux64.zip

RUN geckodriver --version

# phantomjs setup
RUN $INSTALL build-essential chrpath libssl-dev libxft-dev
RUN $INSTALL libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev

RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2
RUN tar -xf phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2
RUN mv phantomjs-${PHANTOMJS_VERSION}-linux-x86_64/bin/phantomjs /usr/local/bin
RUN rm -rf phantomjs-${PHANTOMJS_VERSION}-linux-x86_64
RUN rm phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2

# fix weird phantomjs issue
ENV OPENSSL_CONF=/etc/ssl

RUN phantomjs --version

# install python dependencies
ADD requirements.txt .
RUN $INSTALL python3 python3-pip
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN rm requirements.txt
8 changes: 8 additions & 0 deletions test/docker/compare_output_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

REF="test/data/reference-output/"
OBS="cmake-build-debug/test/output/"
DRIVER="firefox"

docker build --tag odr_core_test test/docker
docker run -ti -v $(pwd):/repo -p 5000:5000 odr_core_test python3 /repo/test/scripts/compare_output_server.py /repo/$REF /repo/$OBS --compare --driver $DRIVER
4 changes: 4 additions & 0 deletions test/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Pillow==10.1.0
selenium==4.15.2
flask==2.3.3
watchdog==2.3.1
8 changes: 4 additions & 4 deletions test/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pillow==9.2.0
selenium==4.3.0
flask==2.1.3
watchdog==2.1.9
Pillow==10.1.0
selenium==4.15.2
flask==2.3.3
watchdog==2.3.1

0 comments on commit 775911a

Please sign in to comment.