Skip to content

Commit b0af9fd

Browse files
committed
Merge branch 'unstable' into websockets
# Conflicts: # Makefile # contentcuration/contentcuration/frontend/shared/data/applyRemoteChanges.js # contentcuration/contentcuration/frontend/shared/data/resources.js # contentcuration/contentcuration/frontend/shared/data/serverSync.js # contentcuration/contentcuration/settings.py # contentcuration/contentcuration/viewsets/base.py # contentcuration/contentcuration/viewsets/channel.py # contentcuration/contentcuration/viewsets/sync/endpoint.py # requirements-dev.txt # requirements.in # requirements.txt
2 parents 99edf3f + 6e3be57 commit b0af9fd

File tree

534 files changed

+29267
-11490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

534 files changed

+29267
-11490
lines changed

.docker/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## What is this directory?
2+
This directory is a space for mounting directories to docker containers, allowing the mounts to be specified in committed code, but the contents of the mounts to remain ignored by git.
3+
4+
### postgres
5+
The `postgres` directory is mounted to `/docker-entrypoint-initdb.d`. Any `.sh` or `.sql` files will be executed when the container is first started with a new data volume. You may read more regarding this functionality on the [Docker Hub page](https://hub.docker.com/_/postgres), under _Initialization scripts_.
6+
7+
When running docker services through the Makefile commands, it specifies a docker-compose project name that depends on the name of the current git branch. This causes the volumes to change when the branch changes, which is helpful when switching between many branches that might have incompatible database schema changes. The downside is that whenever you start a new branch, you'll have to re-initialize the database again, like with `yarn run devsetup`. Creating a SQL dump from an existing, initialized database and placing it in this directory will allow you to skip this step.
8+
9+
To create a SQL dump of your preferred database data useful for local testing, run `make .docker/postgres/init.sql` while the docker postgres container is running.
10+
11+
> Note: you will likely need to run `make migrate` to ensure your database schema is up-to-date when using this technique.
12+
13+
#### pgpass
14+
Stores the postgres authentication for the docker service for scripting access without manually providing a password, created by `make .docker/pgpass`
15+
16+
### minio
17+
The `minio` directory is mounted to `/data`, since it isn't necessarily useful to have this data isolated based off the current git branch.

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
root = true
22

3+
[*]
4+
max_line_length = 100
5+
36
[*.js]
47
indent_size = 2
58

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
blank_issues_enabled: false
2+
contact_links:
3+
- name: Studio GitHub Discussions
4+
url: https://github.com/learningequality/studio/discussions
5+
about: Please ask general questions about contributing to Studio or report development server issues here.
6+
- name: Learning Equality Community Forum
7+
url: https://community.learningequality.org/
8+
about: Ask and answer questions about Learning Equality's products and tools, share your experiences using Kolibri, and connect with users around the world.

.github/dependabot.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,30 @@ updates:
77
- package-ecosystem: "pip"
88
directory: "/"
99
schedule:
10-
interval: "daily"
10+
interval: "weekly"
11+
day: "wednesday"
12+
time: "00:00"
1113

1214
# Maintain dependencies for Javascript
1315
- package-ecosystem: "npm"
1416
directory: "/"
1517
schedule:
16-
interval: "daily"
18+
interval: "weekly"
19+
day: "wednesday"
20+
time: "00:00"
21+
groups:
22+
babel:
23+
patterns:
24+
- "@babel/*"
25+
26+
# Maintain dependencies for Github Actions
27+
- package-ecosystem: "github-actions"
28+
directory: "/"
29+
schedule:
30+
interval: "weekly"
31+
day: "wednesday"
32+
time: "00:00"
33+
groups:
34+
github:
35+
patterns:
36+
- "actions/*"

.github/workflows/containerbuild.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Container Build
2+
3+
on:
4+
push:
5+
branches:
6+
- unstable
7+
- hotfixes
8+
- master
9+
tags:
10+
- 'v*'
11+
pull_request:
12+
13+
jobs:
14+
pre_postgres:
15+
name: Path match check - postgres
16+
runs-on: ubuntu-latest
17+
# Map a step output to a job output
18+
outputs:
19+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
20+
steps:
21+
- id: skip_check
22+
uses: fkirc/skip-duplicate-actions@master
23+
with:
24+
skip_after_successful_duplicate: false
25+
github_token: ${{ github.token }}
26+
paths: '["docker/Dockerfile.postgres.dev", ".github/workflows/containerbuild.yml"]'
27+
28+
build_and_push_postgres:
29+
name: Postgres - build and push Docker image to GitHub Container Registry
30+
needs: pre_postgres
31+
if: ${{ needs.pre_postgres.outputs.should_skip != 'true' }}
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout codebase
35+
uses: actions/checkout@v4
36+
37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Log in to Docker Hub
44+
if: github.event_name != 'pull_request'
45+
uses: docker/login-action@v3
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Extract metadata (tags, labels) for Docker
52+
id: meta
53+
uses: docker/metadata-action@v5
54+
with:
55+
images: ghcr.io/learningequality/postgres
56+
env:
57+
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
58+
59+
- name: Build and push Docker image
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: ./docker
63+
file: ./docker/Dockerfile.postgres.dev
64+
platforms: linux/amd64,linux/arm64
65+
push: ${{ github.event_name != 'pull_request' }}
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}
68+
annotations: ${{ steps.meta.outputs.annotations }}
69+
70+
pre_nginx:
71+
name: Path match check - nginx
72+
runs-on: ubuntu-latest
73+
# Map a step output to a job output
74+
outputs:
75+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
76+
steps:
77+
- id: skip_check
78+
uses: fkirc/skip-duplicate-actions@master
79+
with:
80+
skip_after_successful_duplicate: false
81+
github_token: ${{ github.token }}
82+
paths: '["k8s/images/nginx/*", ".github/workflows/containerbuild.yml"]'
83+
84+
build_nginx:
85+
name: nginx - test build of nginx Docker image
86+
needs: pre_nginx
87+
if: ${{ needs.pre_nginx.outputs.should_skip != 'true' }}
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout codebase
91+
uses: actions/checkout@v4
92+
93+
- name: Set up QEMU
94+
uses: docker/setup-qemu-action@v3
95+
96+
- name: Set up Docker Buildx
97+
uses: docker/setup-buildx-action@v3
98+
99+
- name: Build Docker image
100+
uses: docker/build-push-action@v5
101+
with:
102+
context: ./
103+
file: ./k8s/images/nginx/Dockerfile
104+
platforms: linux/amd64
105+
push: false

.github/workflows/deploytest.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v4
3131
- name: Use Node.js
32-
uses: actions/setup-node@v1
32+
uses: actions/setup-node@v4
3333
with:
3434
node-version: '16.x'
3535
- name: Cache Node.js modules
36-
uses: actions/cache@v2
36+
uses: actions/cache@v4
3737
with:
3838
path: '**/node_modules'
3939
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
@@ -51,13 +51,13 @@ jobs:
5151
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
5252
runs-on: ubuntu-latest
5353
steps:
54-
- uses: actions/checkout@v2
55-
- name: Set up Python 3.9
56-
uses: actions/setup-python@v2
54+
- uses: actions/checkout@v4
55+
- name: Set up Python 3.10
56+
uses: actions/setup-python@v5
5757
with:
58-
python-version: 3.9
58+
python-version: '3.10'
5959
- name: pip cache
60-
uses: actions/cache@v2
60+
uses: actions/cache@v4
6161
with:
6262
path: ~/.cache/pip
6363
key: ${{ runner.os }}-pyprod-${{ hashFiles('requirements.txt') }}
@@ -69,11 +69,11 @@ jobs:
6969
pip install pip-tools
7070
pip-sync requirements.txt
7171
- name: Use Node.js
72-
uses: actions/setup-node@v1
72+
uses: actions/setup-node@v4
7373
with:
7474
node-version: '16.x'
7575
- name: Cache Node.js modules
76-
uses: actions/cache@v2
76+
uses: actions/cache@v4
7777
with:
7878
path: '**/node_modules'
7979
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}

.github/workflows/frontendlint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v4
3131
- name: Use Node.js
32-
uses: actions/setup-node@v1
32+
uses: actions/setup-node@v4
3333
with:
3434
node-version: '16.x'
3535
- name: Cache Node.js modules
36-
uses: actions/cache@v2
36+
uses: actions/cache@v4
3737
with:
3838
path: '**/node_modules'
3939
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
@@ -49,7 +49,7 @@ jobs:
4949
if: github.event.pull_request && github.event.pull_request.head.repo.full_name == github.repository
5050
id: git-check
5151
run: echo ::set-output name=modified::$(git diff-index --name-only HEAD)
52-
- uses: tibdex/github-app-token@v1
52+
- uses: tibdex/github-app-token@v2
5353
if: github.event.pull_request && github.event.pull_request.head.repo.full_name == github.repository && steps.git-check.outputs.modified != ''
5454
id: generate-token
5555
with:

.github/workflows/frontendtest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v4
3131
- name: Use Node.js
32-
uses: actions/setup-node@v1
32+
uses: actions/setup-node@v4
3333
with:
3434
node-version: '16.x'
3535
- name: Cache Node.js modules
36-
uses: actions/cache@v2
36+
uses: actions/cache@v4
3737
with:
3838
path: '**/node_modules'
3939
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Send a slack notification when a contributor comments on issue
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
contributor_issue_comment:
9+
name: Contributor issue comment
10+
11+
if: >-
12+
${{
13+
!github.event.issue.pull_request &&
14+
github.event.comment.author_association != 'MEMBER' &&
15+
github.event.comment.author_association != 'OWNER'
16+
}}
17+
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Escape title double quotes
21+
id: escape_title
22+
run: |
23+
title='${{ github.event.issue.title }}'
24+
echo "ISSUE_TITLE=${title//\"/\\\"}" >> "$GITHUB_OUTPUT"
25+
26+
- name: Send message to Slack channel
27+
env:
28+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
29+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
30+
uses: slackapi/[email protected]
31+
with:
32+
payload: |
33+
{
34+
"text": "*[Studio] New comment on issue: <${{ github.event.issue.html_url }}#issuecomment-${{ github.event.comment.id }}|${{ steps.escape_title.outputs.ISSUE_TITLE }} by ${{ github.event.comment.user.login }}>*"
35+
}

.github/workflows/pythontest.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
# Maps port 6379 on service container to the host
6262
- 6379:6379
6363
steps:
64-
- uses: actions/checkout@v2
64+
- uses: actions/checkout@v4
6565
- name: Set up minio
6666
run: |
6767
docker run -d -p 9000:9000 --name minio \
@@ -70,12 +70,12 @@ jobs:
7070
-v /tmp/minio_data:/data \
7171
-v /tmp/minio_config:/root/.minio \
7272
minio/minio server /data
73-
- name: Set up Python 3.9
74-
uses: actions/setup-python@v2
73+
- name: Set up Python 3.10
74+
uses: actions/setup-python@v5
7575
with:
76-
python-version: 3.9
76+
python-version: '3.10'
7777
- name: pip cache
78-
uses: actions/cache@v2
78+
uses: actions/cache@v4
7979
with:
8080
path: ~/.cache/pip
8181
key: ${{ runner.os }}-pytest-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }}

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ var/
2929
# IntelliJ IDE, except project config
3030
.idea/*
3131
!.idea/studio.iml
32+
# ignore future updates to run configuration
33+
.run/devserver.run.xml
3234

3335
# PyInstaller
3436
# Usually these files are written by a python script from a template
@@ -95,8 +97,11 @@ contentcuration/csvs/
9597
# Ignore the TAGS file generated by some editors
9698
TAGS
9799

98-
# Ignore Vagrant-created files
99-
/.vagrant/
100+
# Services
101+
.vagrant/
102+
.docker/minio/*
103+
.docker/postgres/*
104+
.docker/pgpass
100105

101106
# Ignore test files
102107
/contentcuration/contentcuration/proxy_settings.py

.run/devserver.run.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="devserver" type="PythonConfigurationType" factoryName="Python">
3+
<module name="studio" />
4+
<option name="INTERPRETER_OPTIONS" value="" />
5+
<option name="PARENT_ENVS" value="true" />
6+
<envs>
7+
<env name="PYTHONUNBUFFERED" value="1" />
8+
</envs>
9+
<option name="SDK_HOME" value="$ModuleSdkPath$" />
10+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
11+
<option name="IS_MODULE_SDK" value="true" />
12+
<option name="ADD_CONTENT_ROOTS" value="false" />
13+
<option name="ADD_SOURCE_ROOTS" value="false" />
14+
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
15+
<option name="SCRIPT_NAME" value="contentcuration/manage.py" />
16+
<option name="PARAMETERS" value="runserver --settings=contentcuration.dev_settings 0.0.0.0:8080" />
17+
<option name="SHOW_COMMAND_LINE" value="false" />
18+
<option name="EMULATE_TERMINAL" value="false" />
19+
<option name="MODULE_MODE" value="false" />
20+
<option name="REDIRECT_INPUT" value="false" />
21+
<option name="INPUT_FILE" value="" />
22+
<method v="2" />
23+
</configuration>
24+
</component>

0 commit comments

Comments
 (0)