-
-
Notifications
You must be signed in to change notification settings - Fork 32
Implement hashed file paths #903
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
Changes from 57 commits
f490f15
ad7d653
12883c9
2301d21
31a3919
e63ec49
762b892
ba850c4
550210e
fc7ae05
d9a8dc7
9685d0f
1857496
1b76c38
ca5be90
7f91eae
47daa8b
90bd5d7
f8b05f1
4d21986
b080d58
043efe2
cca66e4
9f98d51
2c7ad5c
ba042c7
22e777d
eb2be76
3ea1abd
49865cf
0497353
4e3dd03
a1e5336
c2940a5
d335a46
1247082
a845228
ef955dc
4e12cfc
1d71b32
6b755f0
e5344fe
b75f07c
db55474
55a8234
389753e
24c0d1a
468296b
5ca032b
7b6deb0
ac2e1f4
e254ec3
dd7d0ae
b702d70
c1027bc
91e1857
9743e2c
6c1bbda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,216 @@ | ||
| name: PWA Lint & Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: ['*'] | ||
| pull_request: | ||
| branches: ['*'] | ||
|
|
||
| jobs: | ||
| setup: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: volta-cli/action@v4 | ||
|
|
||
| - name: Get environment info | ||
| run: | | ||
| node --version | ||
| npm --version | ||
| - name: Restore node_modules cache | ||
| id: restore-node-cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | ||
|
|
||
| - name: Install dependencies | ||
| if: steps.restore-node-cache.outputs.cache-hit != 'true' | ||
| run: | | ||
| echo "Installing dependencies..." | ||
| npm ci | ||
| - name: Cache node_modules | ||
| if: steps.restore-node-cache.outputs.cache-hit != 'true' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | ||
|
|
||
| - name: Restore Projects cache | ||
| id: restore-projects-cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: project_data | ||
| key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }} | ||
|
|
||
| - name: Setup Java | ||
| if: steps.restore-projects-cache.outputs.cache-hit != 'true' | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'zulu' | ||
| java-version: '17' | ||
| java-package: 'jdk' | ||
|
|
||
| - name: Install JFX | ||
| if: steps.restore-projects-cache.outputs.cache-hit != 'true' | ||
| uses: ConorMacBride/install-package@v1 | ||
| with: | ||
| apt: openjfx libopenjfx-jni | ||
|
|
||
| - name: App Builders Install | ||
| if: steps.restore-projects-cache.outputs.cache-hit != 'true' | ||
| 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: Convert Projects | ||
| if: steps.restore-projects-cache.outputs.cache-hit != 'true' | ||
| run: | | ||
| WORK_DIR=$(pwd) | ||
| mkdir project_data | ||
| for PROGRAM in sab dab; do | ||
| echo "Processing projects for $PROGRAM" | ||
| mkdir -p "$HOME/projects/$PROGRAM" | ||
| # Get all projects as JSON array | ||
| PROJECTS_JSON=$(jq -r ".${PROGRAM}.projects" "test_data/projects/index.json") | ||
| # Get number of projects | ||
| NUM_PROJECTS=$(echo "$PROJECTS_JSON" | jq '. | length') | ||
| # Iterate through projects using index | ||
| for ((i=0; i<$NUM_PROJECTS; i++)); do | ||
| # Get project path | ||
| PROJECT_ZIP=$(echo "$PROJECTS_JSON" | jq -r ".[$i].path") | ||
| PROJECT_NAME=$(basename "$PROJECT_ZIP" .zip) | ||
| echo "Project: $PROJECT_NAME" | ||
| PROJECT_DIR="$HOME/projects/${PROGRAM}/$PROJECT_NAME" | ||
| mkdir -p "$PROJECT_DIR" | ||
| unzip -q "test_data/projects/${PROGRAM}/$PROJECT_ZIP" -d "$PROJECT_DIR" | ||
| npm run clean:all > /dev/null | ||
| pushd "$PROJECT_DIR" > /dev/null | ||
| PROJECT_FILE=$(find . -type f -name "*.appDef") | ||
| "$HOME/app-builders/${PROGRAM}.sh" -load "$PROJECT_FILE" -build-modern-pwa-data-files -no-save -fp pwa-repo="$WORK_DIR" > /dev/null | ||
| popd > /dev/null | ||
| mkdir "project_data/$PROJECT_NAME" | ||
| mv data/* "project_data/$PROJECT_NAME" | ||
| du -h "project_data/$PROJECT_NAME" | ||
| done | ||
| done | ||
| du -h project_data | ||
| - name: Cache Extracted Projects | ||
| if: steps.restore-projects-cache.outputs.cache-hit != 'true' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: project_data | ||
| key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }} | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| needs: setup | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: volta-cli/action@v4 | ||
|
|
||
| - name: Restore node_modules cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | ||
|
|
||
| - name: Restore Projects cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: project_data | ||
| key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }} | ||
|
|
||
| - name: Convert minimal project | ||
| run: | | ||
| npm run convert -- --data-dir=project_data/web_gospels | ||
| - name: TypeScript/Svelte Check | ||
| run: | | ||
| npm list --depth=0 typescript | ||
| npm run check | ||
| - name: ESLint | ||
| run: | | ||
| npm list --depth=0 eslint eslint-plugin-import prettier | ||
| npm run lint | ||
| - name: Run minimal build | ||
| run: | | ||
| npx vite build | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| needs: setup | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: volta-cli/action@v4 | ||
|
|
||
| - name: Restore node_modules cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | ||
|
|
||
| - name: Restore Projects cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: project_data | ||
| key: ${{ runner.os }}-projects-${{ hashFiles('test_data/projects', 'convert/*.ts') }} | ||
|
|
||
| - name: Run Tests | ||
| run: | | ||
| WORK_DIR=$(pwd) | ||
| for PROGRAM in sab dab; do | ||
| echo "Processing projects for $PROGRAM" | ||
| mkdir -p "$HOME/projects/$PROGRAM" | ||
| # Get all projects as JSON array | ||
| PROJECTS_JSON=$(jq -r ".${PROGRAM}.projects" "test_data/projects/index.json") | ||
| # Get number of projects | ||
| NUM_PROJECTS=$(echo "$PROJECTS_JSON" | jq '. | length') | ||
| # Iterate through projects using index | ||
| for ((i=0; i<$NUM_PROJECTS; i++)); do | ||
| # Get project path and test directories | ||
| PROJECT_ZIP=$(echo "$PROJECTS_JSON" | jq -r ".[$i].path") | ||
| TEST_DIRS=$(echo "$PROJECTS_JSON" | jq -r ".[$i].tests[]") | ||
| PROJECT_NAME=$(basename "$PROJECT_ZIP" .zip) | ||
| echo "Project: $PROJECT_NAME" | ||
| npm run clean:all > /dev/null | ||
| cp -r "project_data/$PROJECT_NAME/." data | ||
| npm run build | ||
| # Run tests for each specified directory | ||
| for TEST_DIR in $TEST_DIRS; do | ||
| echo "Running tests in directory: $TEST_DIR" | ||
| npm run test "$TEST_DIR" | ||
| done | ||
| done | ||
FyreByrd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| done | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ src/lib/data/firebase-config.js | |
| static | ||
| example_data | ||
| test_data | ||
| /project_data | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this here?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. project_data is the folder that the gha puts extracted projects into for caching later. When lint is run, prettier complains about the formatting of the files in this folder, causing the lint action to fail. |
||
| *.md | ||
|
|
||
| # Ignore files for PNPM, NPM and YARN | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.