Skip to content

Commit

Permalink
Add project data and run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvire committed Nov 26, 2024
1 parent 68ae46f commit 865fb70
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 25 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
63 changes: 63 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
Binary file added test_data/projects/dab/hanga.zip
Binary file not shown.
12 changes: 12 additions & 0 deletions test_data/projects/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"sab" : {
"projects" : [
"web_gospels.zip"
]
},
"dab": {
"projects" : [
"hanga.zip"
]
}
}
Binary file added test_data/projects/sab/web_gospels.zip
Binary file not shown.

0 comments on commit 865fb70

Please sign in to comment.