diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6d74bb3d3..6e0ed1ea3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,23 +15,6 @@ jobs: - uses: volta-cli/action@v4 - - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: '17' - java-package: 'jre+fx' - - - name: App Builders Install - run: | - docker pull ghcr.io/sillsdev/app-builders:latest - container_id=$(docker create ghcr.io/sillsdev/app-builders:latest bash) - mkdir /app-builders - docker cp "$container_id:/" /app-builders - docker rm "$container_id" - chmod +x /app-builders/*.sh - java -version - /app-builders/sab.sh -? | head -n 4 - - name: NPM Install run: | node --version @@ -57,11 +40,3 @@ jobs: run: | npm list --depth=0 eslint eslint-plugin-import prettier npm run lint - - - name: Build - run: | - npm run build:examples - - - name: Test - run: | - npm run test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..5622c7ab9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,63 @@ +name: Test + +on: + pull_request: + branches: ['*'] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: volta-cli/action@v4 + + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + java-package: 'jre+fx' + + - name: App Builders Install + run: | + docker pull ghcr.io/sillsdev/app-builders:latest + container_id=$(docker create ghcr.io/sillsdev/app-builders:latest bash) + mkdir $HOME/app-builders + docker cp "$container_id:/" $HOME/app-builders + docker rm "$container_id" + chmod +x $HOME/app-builders/*.sh + java -version + $HOME/app-builders/sab.sh -? | head -n 4 + + - name: NPM Install + run: | + node --version + npm --version + npm i + cd convert + npm i + + - name: Run Tests + run: | + WORK_DIR=$(pwd) + for PROGRAM in sab rab; do + echo "Processing projects for $PROGRAM" + mkdir -p "$HOME/projects/$PROGRAM" + PROJECTS=$(jq -r ".${PROGRAM}.projects[]" "test_data/projects/index.json") + echo "PROJECTS=$PROJECTS" + for PROJECT in $PROJECTS; do + echo "Processing project: $PROJECT" + PROJECT_DIR="$HOME/projects/${PROGRAM}/${PROJECT%%/*}" + echo "PROJECT_DIR=${PROJECT_DIR}" + mkdir -p "$PROJECT_DIR" + unzip -q "test_data/projects/${PROGRAM}/$PROJECT" -d "$PROJECT_DIR" + pushd "$PROJECT_DIR" > /dev/null + PROJECT_FILE=$(find . -type -f -name "*.appDef") + echo "PROJECT_FILE=$PROJECT_FILE" >> $GITHUB_ENV + + "$HOME/app-builders/${PROGRAM}.sh" -load "$PROJECT_FILE" -build-modern-pwa-data-files -no-save -fp pwa-repo="${WORK_DIR}/data" + npm run test + popd > /dev/null + done + done diff --git a/test_data/projects/dab/hanga.zip b/test_data/projects/dab/hanga.zip new file mode 100644 index 000000000..79d56645d Binary files /dev/null and b/test_data/projects/dab/hanga.zip differ diff --git a/test_data/projects/index.json b/test_data/projects/index.json new file mode 100644 index 000000000..cab0dbd7a --- /dev/null +++ b/test_data/projects/index.json @@ -0,0 +1,12 @@ +{ + "sab" : { + "projects" : [ + "web_gospels.zip" + ] + }, + "dab": { + "projects" : [ + "hanga.zip" + ] + } +} \ No newline at end of file diff --git a/test_data/projects/sab/web_gospels.zip b/test_data/projects/sab/web_gospels.zip new file mode 100644 index 000000000..9840af1c5 Binary files /dev/null and b/test_data/projects/sab/web_gospels.zip differ