Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
megahirt committed Oct 3, 2022
2 parents 904ed6e + 20a6afa commit 7b16411
Show file tree
Hide file tree
Showing 120 changed files with 8,711 additions and 6,122 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Bug report
about: Create a report to help us improve
title: 'bug: '
labels: triage
assignees: ''

---
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Feature request
about: Suggest an idea for this project
title: 'feat: '
labels: triage
assignees: ''

---
Expand Down
24 changes: 12 additions & 12 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Fixes # (issue)

## Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

### Type of Change

Only keep lines below that describe this change, then delete the rest.
Expand All @@ -19,23 +19,23 @@ Only keep lines below that describe this change, then delete the rest.

Please provide screenshots / animations for any change that involves the UI. Please provide animations to demonstrate user interaction / behavior changes

## Testing on your branch

Please describe how to test and/or verify your changes. Provide instructions so we can reproduce. Please also provide relevant test data as necessary. These instructions will be used for QA testing below.

- [ ] Test A
- [ ] Test B

## Checklist

- [ ] I have performed a self-review of my own code
- [ ] I have reviewed the title/description of this PR which will be used as the squashed PR commit message
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests that prove my fix is effective or that my feature works

## How to test

Please describe how to test and/or verify your changes. Provide instructions so we can reproduce. Please also provide relevant test data as necessary. These instructions will be used for QA testing below.

- [ ] Test A
- [ ] Test B

## qa.languageforge.org testing

Reviewers: add/replace your name below and check the box to sign-off/attest the feature works as expected on qa.languageforge.org
Testers: Check the box and put in a date/time to sign-off/attest the feature works as expected on qa.languageforge.org

- [ ] Reviewer1 (YYYY-MM-DD HH:MM)
- [ ] Reviewer2 (YYYY-MM-DD HH:MM)
- [ ] Tester1 (YYYY-MM-DD HH:MM)
- [ ] Tester2 (YYYY-MM-DD HH:MM)
16 changes: 8 additions & 8 deletions .github/workflows/integrate-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ jobs:
-
name: Build legacy app
run: |
docker-compose build --build-arg ENVIRONMENT=production --build-arg BUILD_VERSION=${{ steps.image.outputs.TAG }} app
docker-compose build --build-arg ENVIRONMENT=production --build-arg BUILD_VERSION=${{ steps.image.outputs.TAG_APP }} app
docker-compose run --rm app cat /var/www/html/build-version.txt /var/www/html/version.php
-
name: Build "next" images
run: make build-next
-
name: Unit Tests
run: make unit-tests-ci
-
name: E2E Tests
working-directory: .
run: |
docker-compose -f docker/docker-compose.yml up -d app-for-playwright
npx playwright install
npx playwright test
# -
# name: E2E Tests
# working-directory: .
# run: |
# docker-compose -f docker/docker-compose.yml up -d app-for-playwright
# npx playwright install chromium
# npx playwright test
-
name: Log in to Docker Hub
uses: docker/login-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsecrets
secrets:
kube-context: ${{ secrets.LTOPS_K8S_PRODUCTION_CONTEXT }}
kube-context: ${{ secrets.K8S_PRODUCTION_CONTEXT }}
image-repo-username: ${{ secrets.DOCKERHUB_USERNAME }}
image-repo-password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
31 changes: 25 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,33 @@ jobs:
run: |
npm ci
docker-compose build app
-
name: Playwright E2E Tests
- name: Get installed Playwright version
id: playwright-version
# https://github.com/microsoft/playwright/issues/7249#issuecomment-1201476980
run: echo -n "::set-output name=version::$(npm ls @playwright/test --json | jq --raw-output '.dependencies["@playwright/test"].version')"

# https://github.com/microsoft/playwright/issues/7249#issuecomment-1154603556
- name: Cache playwright browsers
uses: actions/cache@v3
id: playwright-cache
with:
path: '~/.cache/ms-playwright'
# Make each playwright version use its own cache in case it uses different browser versions
# Cache entries are deleted if not accessed for 7 days
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
key: 'playwright-${{ steps.playwright-version.outputs.version }}'

- name: Playwright E2E Tests
working-directory: .
# see https://playwright.dev/docs/ci#github-actions
run: |
docker-compose -f docker/docker-compose.yml up -d app-for-playwright
npx playwright install
npx playwright test
run: npm run make playwright-tests

- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results

# protractor-tests:
# runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/set-backlog-fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ jobs:
}
}
}' -f org=$ORGANIZATION > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "ProductOwner") | .id' project_data.json) >> $GITHUB_ENV
echo 'TRIAGE_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "ProductOwner") | .settings | fromjson.options[] | select(.name=="Triage") | .id' project_data.json) >> $GITHUB_ENV
echo 'INCOMING_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "ProductOwner") | .settings | fromjson.options[] | select(.name=="Incoming") | .id' project_data.json) >> $GITHUB_ENV
- name: Add issue to project
if: env.IN_PROJECT == 0
env:
Expand Down Expand Up @@ -105,5 +105,5 @@ jobs:
id
}
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f field=$FIELD_ID -f field_value=${{ env.TRIAGE_ID }}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f field=$FIELD_ID -f field_value=${{ env.INCOMING_ID }}
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsecrets
secrets:
kube-context: ${{ secrets.LTOPS_K8S_STAGING_CONTEXT }}
kube-context: ${{ secrets.K8S_STAGING_CONTEXT }}
image-repo-username: ${{ secrets.DOCKERHUB_USERNAME }}
image-repo-password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
25 changes: 13 additions & 12 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"amodio.tsl-problem-matcher",
"msjsdiag.debugger-for-chrome",
"ms-vscode-remote.remote-containers",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"xdebug.php-pack",
"svelte.svelte-vscode",
"bradlc.vscode-tailwindcss"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"amodio.tsl-problem-matcher",
"msjsdiag.debugger-for-chrome",
"ms-vscode-remote.remote-containers",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"xdebug.php-pack",
"svelte.svelte-vscode",
"bradlc.vscode-tailwindcss",
"ms-playwright.playwright"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ We're glad you're here! Read our [Contributing Guide](CONTRIBUTING.md) for how

## Developers ##

Please see our [Developer Guide](docs/DEVELOPER.md) for developer best practices and environment setup
Please see our [Developer Guide](docs/DEVELOPER.md) for developer best practices and environment setup.

For production deployment and release instructions, there is a separate [Production Deployment and Release Guide](docs/RELEASE.md).
14 changes: 6 additions & 8 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ playwright-tests:
# wait until the app-for-playwright service is serving up HTTP before continuing
until curl localhost:3238 > /dev/null 2>&1; do sleep 1; done

cd .. && npx playwright install && npx playwright test
cd .. && npx playwright install chromium && npx playwright test $(params)

.PHONY: e2e-tests
e2e-tests:
Expand Down Expand Up @@ -74,11 +74,9 @@ clean:
docker compose down
docker system prune -f

.PHONY: clean-volumes
clean-volumes:
docker compose down -v
docker system prune -f --volumes

.PHONY: clean-powerwash
clean-powerwash: clean-volumes
docker compose down --rmi all
clean-powerwash: clean
docker system prune -f --volumes
docker rmi -f `docker images -q "lf-*"`
docker image rm sillsdev/web-languageforge:base-php
docker builder prune -f
3 changes: 2 additions & 1 deletion docker/base-php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ FROM php:7.3.28-apache
# p7zip-full - used by LF application for unzipping lexicon uploads
# unzip - used by LF application for unzipping lexicon uploads
# curl - used by LF application
RUN apt-get update && apt-get -y install p7zip-full unzip curl tini && rm -rf /var/lib/apt/lists/*
# ffmpeg - used by LF audio upload method
RUN apt-get update && apt-get -y install p7zip-full unzip curl tini ffmpeg && rm -rf /var/lib/apt/lists/*

# see https://github.com/mlocati/docker-php-extension-installer
# PHP extensions required by the LF application
Expand Down
1 change: 1 addition & 0 deletions docker/db/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dump
14 changes: 14 additions & 0 deletions docker/db/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
clean:
docker compose down

db:
docker compose up -d db

dump: db
docker compose exec db mongodump
docker compose cp db:/dump ./dump

restore: db
docker compose cp ./dump db:/dump
docker compose exec db mongorestore

43 changes: 43 additions & 0 deletions docker/db/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Creating and utilizing any test data

## Create a dump

1. start the app
1. create all the data you want through the app
1. `make dump clean` to create a `dump` folder in this directory
1. `tar -cf <name-representative-of-data>.tar dump`, e.g., `tar -cf activity.tar dump`, and decide whether to commit this or not for others to use.

## Load a dump

1. `tar -xf <name-representative-of-data>.tar` and rename to `dump`
1. `make restore clean` to load the `dump` directory

# Common mongo commands

> https://www.mongodb.com/docs/v4.4/mongo
`mongo` within `db` container

> https://www.mongodb.com/docs/manual/reference/mongo-shell/#command-helpers
`show dbs`

`use scriptureforge`

`show collections`

`exit`

> https://www.mongodb.com/docs/manual/reference/mongo-shell/#queries
`db.users.find()`

# Test data

## Activity

| username | email | password | project |
| -------- | ------------------- | ------------- | ----------- |
| admin | admin@example.com | password | all |
| johndoe | jd@example.org | languageforge | project-1 |
| janedoe | janedoe@example.org | languageforge | project-2 |
Binary file added docker/db/activity.tar
Binary file not shown.
2 changes: 1 addition & 1 deletion docker/deployment/app-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ spec:
memory: 110Mi
cpu: 0.1
limits:
memory: 200Mi
memory: 500Mi
volumeMounts:
- mountPath: /var/www/html/assets
name: assets
Expand Down
5 changes: 3 additions & 2 deletions docker/deployment/next-app-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ spec:
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
resources:
requests:
memory: 16Mi
memory: 100Mi
cpu: 0.1
limits:
memory: 20Mi
memory: 500Mi
env:
- name: API_HOST
value: http://app

4 changes: 2 additions & 2 deletions docker/deployment/next-proxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ spec:
imagePullPolicy: Always
resources:
requests:
memory: 12Mi
memory: 25Mi
cpu: 0.1
limits:
memory: 20Mi
memory: 75Mi
env:
- name: LEGACY_APP
value: app:80
Expand Down
1 change: 0 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ services:
dockerfile: docker/test-php/Dockerfile
image: test-php
container_name: test-php
platform: linux/amd64
depends_on:
- db
- mail
Expand Down
2 changes: 1 addition & 1 deletion docker/lfmerge/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM ghcr.io/sillsdev/lfmerge:2.0.123
FROM ghcr.io/sillsdev/lfmerge:2.0.131
# Do not add anything to this Dockerfile, it should stay empty
2 changes: 2 additions & 0 deletions docker/next-app/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
:80 {
@next_app_paths {
path /_app/*
# ref for existing: /src/index.php
path /app/changepassword
path /password*
path /projects*
}
route @next_app_paths {
rewrite /app/changepassword /password/change
Expand Down
2 changes: 1 addition & 1 deletion docker/next-app/Dockerfile.next-app
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:alpine AS builder

WORKDIR /app

COPY jsconfig.json package-lock.json package.json postcss.config.cjs svelte.config.js tailwind.config.cjs /app/
COPY tsconfig.json package-lock.json package.json postcss.config.cjs svelte.config.js vite.config.js tailwind.config.cjs /app/
COPY src /app/src
COPY static /app/static

Expand Down
13 changes: 8 additions & 5 deletions docker/next-app/dev/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

:80 {
@next_app_paths {
path *svelte* # when running next-app in dev mode, this is needed.
path *node_modules* # when running next-app in dev mode, this is needed.
path *vite* # when running next-app in dev mode, this is needed.
path /src/lib* # when running next-app in dev mode, this is needed.
path /_app/*
# when running next-app in dev mode, these are needed.
path /.svelte-kit/*
path *node_modules*
path /@vite/*
path /src/*

# ref for existing: /src/index.php
path /app/changepassword
path /password*
path /projects*
}
route @next_app_paths {
rewrite /app/changepassword /password/change
Expand Down
Loading

0 comments on commit 7b16411

Please sign in to comment.