From 02765616f810def8a74574b044cd96e601f5a756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar?= Date: Thu, 2 Sep 2021 13:30:26 +0200 Subject: [PATCH] Add CI * Add CI --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ tests/run.sh | 6 +++--- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..265d4b0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/tests/run.sh b/tests/run.sh index ee2da8f..42314dc 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -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 @@ -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 \ @@ -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"