Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github Actions Workflow to build and (unit-)test Audiveris #665

Merged
merged 4 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/install-tessdata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
set -e

# This script loads tesseract-ocr files from github

verify_single_argument_given() {
if [ $# -eq 0 ]; then
echo "No arguments supplied. Run e.g. 'install-tessdata.sh eng'. Aborting."
exit 1
fi
if [ $# -gt 1 ]; then
echo "Too many arguments supplied. Run e.g. 'install-tessdata.sh eng'. Aborting."
exit 1
fi
}

verify_tessdata_prefix_set() {
if [ -z "${TESSDATA_PREFIX}" ]; then
echo "Environment variable TESSDATA_PREFIX is not set. Aborting."
exit 2
fi
}

verify_tessdata_tag_set() {
if [ -z "${TESSDATA_TAG}" ]; then
echo "Environment variable TESSDATA_TAG is not set. Please set it to a valid github tag of tesseract-ocr/tessdata. Aborting."
exit 2
fi
}

install_tessdata_language() {
language=$1
echo "Loading tessdata language $language..."
wget --no-verbose -P "$TESSDATA_PREFIX" "https://github.com/tesseract-ocr/tessdata/raw/${TESSDATA_TAG}/${language}.traineddata"
}

verify_single_argument_given "$@"
verify_tessdata_prefix_set
verify_tessdata_tag_set
install_tessdata_language "$1"
48 changes: 48 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build & Test Audiveris

# execute this workflow on every push
on:
- push

permissions:
contents: read

jobs:
build-and-test:
runs-on: ubuntu-latest
env:
TESSDATA_PREFIX: /home/runner/work/audiveris/audiveris/tessdata
TESSDATA_TAG: 4.1.0
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: zulu

# cache loaded tessdata files so they don't have to be re-downloaded on every workflow execution
- name: Get cached tessdata files
id: cache-tessdata
uses: actions/cache@v3
with:
path: ${{ env.TESSDATA_PREFIX }}
key: ${{ runner.os }}-tessdata-${{ env.TESSDATA_TAG }}-eng-deu

- name: Install tessdata files
if: steps.cache-tessdata.outputs.cache-hit != 'true'
run: |
${GITHUB_WORKSPACE}/.github/install-tessdata.sh eng &&
${GITHUB_WORKSPACE}/.github/install-tessdata.sh deu

- name: Build Audiveris
uses: gradle/[email protected]
with:
arguments: build -x test

- name: Unit-Test Audiveris
uses: gradle/[email protected]
with:
arguments: test