Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
* Add CI
  • Loading branch information
mondeja authored Sep 2, 2021
1 parent f992c13 commit 0276561
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- master
tags:
- v*
pull_request:
workflow_dispatch:

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
inkscape-ppa:
- stable
- stable-1.1
fail-fast: false
env:
DISPLAY: :0
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install -y xvfb
- name: Install Inkscape
run: |
sudo add-apt-repository ppa:inkscape.dev/${{ matrix.inkscape-ppa }}
sudo apt-get update
sudo apt-get install -y inkscape
- name: Start Xvfb in background
run: sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Run tests
run: sh tests/run.sh
6 changes: 3 additions & 3 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ move_extension_to_user_extensions_directory() {
configure_profile_preferences() {
locale="$1"
preferences_filepath="$(inkscape --user-data-directory)/preferences.xml"
locale_pref="$(< $preferences_filepath grep -o "org.inkscape.text.braille-l18n.locale")"
locale_pref="$(< $preferences_filepath grep -o "org.inkscape.text.braille-l18n.locale" || true)"

# if locale preference is present
if [ -n "$locale_pref" ]; then
Expand Down Expand Up @@ -95,7 +95,7 @@ test_extension_effect() {
configure_profile_preferences "$locale"

# run extension using inkscape in headless mode with Xvfb
xvfb-run inkscape \
xvfb-run --auto-servernum inkscape \
--batch-process \
--export-plain-svg \
--vacuum-defs \
Expand All @@ -106,7 +106,7 @@ test_extension_effect() {
extract_svg_output_text "$svg_output_filepath" > "$txt_output_filepath"

if ! diff --brief "$txt_output_filepath" "$txt_expect_filepath"; then
printf "Red: $txt_output_filepath - Green: $txt_expect_filepath\n"
printf "<: $txt_output_filepath\n>: $txt_expect_filepath\n"
# ignore error (or file exits due to 'set -e')
diff --color "$txt_output_filepath" "$txt_expect_filepath" || true
printf "\n"
Expand Down

0 comments on commit 0276561

Please sign in to comment.