Skip to content

Commit

Permalink
Merge branch 'master' into chore/external-grader-local-async-await
Browse files Browse the repository at this point in the history
  • Loading branch information
nwalters512 committed Apr 11, 2022
2 parents 64e7a51 + d3ed76d commit 66cf88e
Show file tree
Hide file tree
Showing 266 changed files with 7,577 additions and 4,858 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
8 changes: 8 additions & 0 deletions .changeset/config.json
@@ -0,0 +1,8 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.4/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "minor"
}
5 changes: 5 additions & 0 deletions .changeset/quiet-poems-sleep.md
@@ -0,0 +1,5 @@
---
'@prairielearn/html': patch
---

Change transpiled code to use ES2020 syntax
2 changes: 2 additions & 0 deletions .dockerignore
Expand Up @@ -9,6 +9,7 @@
!.prettierignore
!.prettierrc.json
!tsconfig.json
!turbo.json
!pyrightconfig.json
!admin_queries/
!api/
Expand All @@ -28,6 +29,7 @@
!package.json
!yarn.lock
!pages/
!packages/
!prairielib/
!public/
!question-servers/
Expand Down
3 changes: 3 additions & 0 deletions .eslintignore
Expand Up @@ -8,3 +8,6 @@
/out/
/workspaces/
/site/

# Transpiled code
packages/*/dist/
8 changes: 8 additions & 0 deletions .eslintrc.js
Expand Up @@ -28,4 +28,12 @@ module.exports = {
},
],
},
overrides: [
{
files: ['*.test.{js,ts,mjs}'],
env: {
mocha: true,
},
},
],
};
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Expand Up @@ -4,7 +4,6 @@ on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -55,6 +54,11 @@ jobs:
run: docker exec test_container /PrairieLearn/docker/typecheck_python.sh
- name: Run the JavaScript tests
run: docker exec test_container /PrairieLearn/docker/test_js.sh
# The JS tests hang relatively often when someone makes a mistake in a PR,
# and the GitHub Actions default timeout is 6 hours, so the CI run keeps
# spinning until it eventually times out. This shorter timeout helps
# ensure that the tests fail more quickly so that people can fix them.
timeout-minutes: 30
- name: Run the Python tests
run: docker exec test_container /PrairieLearn/docker/test_python.sh
- name: Copy code-coverage data out of container
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,47 @@
name: Release

# We want this workflow to run on master, but only after we've finished the
# main CI workflow. This ensures that, for instance, if integration tests
# fail on master, we don't accidentally publish broken versions of pacakges.
#
# See the `if` condition on the `release` job for the second half of this logic.
on:
workflow_run:
workflows:
- CI
branches:
- master
types:
- completed

jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x

- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This invokes the `release` script in `package.json`, which will build
# all the packages and then invoke `changeset publish`.
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This token was generated by Nathan Walters on 8 February 2022.
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -82,3 +82,9 @@ __pycache__/

## s3rver file store
/s3rver

## Turborepo caches
.turbo

## Compiled package files
packages/*/dist
15 changes: 15 additions & 0 deletions .prettierignore
@@ -1,6 +1,18 @@
node_modules

# Test coverage
coverage/

# Transpiled files
packages/*/dist

# `changesets` ships with an outdated version of Prettier that fights with our
# own version. Until they update their Prettier version or switch to loading
# the version of Prettier that consumers have installed, we'll exclude the
# changesets-managed changelogs from our Prettier formatting/checking.
# See https://github.com/changesets/changesets/issues/616
packages/*/CHANGELOG.md

# The `public/localscripts/calculationQuestion` directory unfortunately
# contains a mixture of first-party and vendored third-party scripts. We want
# to format our own scripts, but we should avoid formatting anything that was
Expand Down Expand Up @@ -33,3 +45,6 @@ public/javascripts/underscore.js

# This is auto-generated by mkdocs.
docs/code-docs/

# pytest cache
.pytest_cache/
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,49 @@
# Contributing to PrairieLearn

Thanks for your interest in contributing to PrairieLearn!

## Before you start to code

If you're making a small enhancement, fixing a typo, or updating some documentation, you can jump ahead without getting any maintainers involved first. Onward!

If you want to make a larger change, such as implementing a new feature, changing an API, or introducing a new [element](./docs/elements.md), you should first start a discussion with the maintainers to make sure that your change would ultimately be accepted. This can be in the form of a GitHub issue or discussion, or for really big features, you can open a PR with an [RFC](./rfcs/). The maintainers will work with you to answer any questions, fill in any gaps, and ensure that your proposed change will integrate well into PrairieLearn.

## Setup

Before you start contributing, you'll need to [fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the repo.

Once you've forked, you'll need to clone your fork and set up your development environment. Depending on your preferred workflow, you can [develop inside of a Docker container](./docs/installingLocal.md) that has all the dependencies pre-installed, or you can [develop "natively" directly on your computer](./docs/installingNative.md).

## Development

You're now ready to start implementing your changes!

The aforementioned setup documentation also includes instructions on starting a server, running tests, and running the linters.

The [dev guide](./docs/dev-guide.md) is currently quite long and dense, but it contains a lot of information about our preferences, conventions, and code structure.

If you get stuck, reach out to the friendly folks in the `#pl-dev` channel on the [PrairieLearn Slack](https://go.illinois.edu/PrairieLearnSlack)!

## Opening a pull request

We follow the [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) for all changes:

- You should work on a distinct branch, not `master`. While this isn't strictly necessary for forks, it's helpful if you want to be working on multiple independent changes at the same time.
- When committing your changes, use a short but meaningful commit message, e.g. `fix rate limiting` instead of `fix`.
- Once you're happy with your changes, [open a pull request (PR)](https://docs.github.com/en/articles/creating-a-pull-request).
- You should include a reasonable amount of information with your pull request, such as a summary of what changes you made and why they were made.
- For changes that impact UI, it can be helpful to include screenshots and screen recordings.
- If applicable, include instructions on how to manually test or verify your change.
- If the change you're making will resolve an existing issue, you should [link the issue to the pull request](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue) so that the issue is closed automatically once the pull request is merged.
- Monitor the [GitHub status checks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks). If they fail, you should check the output to see why. You may need to fix a broken test, adjust the formatting of your code, or fix a lint error.
- Like many open-source projects, we require you to "sign" a contributor license agreement (CLA) prior to accepting any contributions. When you open your first pull request, a bot will prompt you to leave a comment stating that you accept the terms of [our CLA](https://github.com/PrairieLearn/cla).
- One or more PrairieLearn maintainers will review your PR. You should be prepared to engage with the maintainers to answer questions, update code, etc.
- Once the PR is in a satisfactory state, a maintainer will approve and merge your change! :tada:

## Using your changes in production

After your changes have been merged to `master`, a new [`prairielearn/prairielearn` Docker image](https://hub.docker.com/r/prairielearn/prairielearn) will be built and published to Docker Hub. If you're developing course content locally, you can then run `docker pull prairielearn/prairielearn` to access the new image.

Usually, your changes will be deployed to all production instances of PrairieLearn within a week. Watch the `#announce` Slack channel to see when your change has been deployed. If it's been several weeks since your PR has been merged and your changes still haven't been deployed, feel free to reach out in the `#pl-dev` Slack channel.

Note that the cadence of deploys may be impacted by typical academic calendars. That is, we may deploy fewer changes less often during December or May when final exams are in session.
7 changes: 7 additions & 0 deletions Dockerfile
Expand Up @@ -4,6 +4,12 @@ ENV PATH="/PrairieLearn/node_modules/.bin:$PATH"

# Install Python/NodeJS dependencies before copying code to limit download size
# when code changes.
#
# Note that we also have to copy the `packages` directory so that `yarn`
# can resolve the workspaces inside it and set up symlinks correctly.
# This is suboptimal, as a change to any file under `package/` will
# invalidate this layer's cache, but it's unavoidable.
COPY packages/ /PrairieLearn/packages/
COPY package.json yarn.lock /PrairieLearn/
RUN cd /PrairieLearn \
&& yarn install --frozen-lockfile \
Expand All @@ -19,6 +25,7 @@ RUN chmod +x /PrairieLearn/docker/init.sh \
&& mkdir -p /jobs \
&& /PrairieLearn/docker/start_postgres.sh \
&& cd /PrairieLearn \
&& make build \
&& node server.js --migrate-and-exit \
&& su postgres -c "createuser -s root" \
&& /PrairieLearn/docker/start_postgres.sh stop \
Expand Down
15 changes: 13 additions & 2 deletions Makefile
@@ -1,11 +1,17 @@
export PATH := node_modules/.bin/:$(PATH)

build:
@turbo run build

dev:
@turbo run dev

start: start-support
@node server.js
start-nodemon: start-support
@nodemon -L server.js
start-workspace-host: start-support kill-running-workspaces
@node workspace_host/interface.js &
@node workspace_host/interface.js

kill-running-workspaces:
@docker/kill_running_workspaces.sh
Expand All @@ -19,7 +25,7 @@ start-s3rver:
@docker/start_s3rver.sh

test: test-js test-python
test-js: test-prairielearn test-prairielib test-grader-host
test-js: test-prairielearn test-prairielib test-grader-host test-packages
test-prairielearn: start-support
@nyc --reporter=lcov mocha --full-trace tests/index.js
test-prairielib:
Expand All @@ -28,6 +34,8 @@ test-grader-host:
@jest grader_host/
test-nocoverage: start-support
@mocha tests/index.js
test-packages:
@turbo run test
test-python:
# `pl_unit_test.py` has an unfortunate file name - it matches the pattern that
# pytest uses to discover tests, but it isn't actually a test file itself. We
Expand Down Expand Up @@ -65,3 +73,6 @@ depcheck:
@echo WARNING: Note that many devDependencies will show up as unused. This is not
@echo WARNING: a problem.
@echo WARNING:

changeset:
@changeset
30 changes: 30 additions & 0 deletions admin_queries/course_instance_active_enrollments.json
@@ -0,0 +1,30 @@
{
"description": "Course instances that are active within a given date range.",
"params": [
{
"name": "institution_short_name",
"description": "Restrict to a particular institution (blank means all institutions).",
"default": ""
},
{
"name": "start_date",
"description": "Start of the date range (e.g., first day of the academic yaer).",
"default": "2021-01-01T00:00:00"
},
{
"name": "end_date",
"description": "End of the date range (e.g., last day of the academic year).",
"default": "2022-01-01T00:00:00"
},
{
"name": "minimum_instance_question_count",
"description": "Minimum number of modified instance questions for a student to be included.",
"default": "10"
},
{
"name": "minimum_student_count",
"description": "Minimum number of students for a course instance to be included.",
"default": "10"
}
]
}

0 comments on commit 66cf88e

Please sign in to comment.