Skip to content

Commit

Permalink
Release infrastructure + better README.
Browse files Browse the repository at this point in the history
  • Loading branch information
krashanoff committed Mar 5, 2022
1 parent 771a0f5 commit 1e867e3
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 24 deletions.
64 changes: 54 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gradebetter

[![Release](https://img.shields.io/github/v/release/cs130-w21/template?label=release)](https://github.com/cs130-w21/template/releases/latest)
[![Release](https://img.shields.io/github/v/release/cs130-w22/Group-A3?label=release)](https://github.com/cs130-w22/Group-A3/releases/latest)

Gradebetter is a minimalistic grading server for individual classes and small organizations.
It provides the following components in a single package:
Expand All @@ -16,14 +16,33 @@ It provides the following components in a single package:

The project levers the following technologies:
* [echo](https://echo.labstack.com/), for its HTTP server
* []
* [React](https://reactjs.org/)
* [sqlite](https://sqlite.org/index.html), for its embedded database

## Setup
## Running From Binary

1. Download the latest release of the project for your architecture from the [releases](https://github.com/cs130-w22/Group-A3/releases) tab.
2. Once downloaded, unpack the server to the directory you would like to serve from.
3. Run `./gradebetter` and visit `localhost:8080`!

## Building + Running From Source

You will require:
* [Go](https://go.dev/)
* [Node](https://nodejs.org/en/)
* [Yarn](https://yarnpkg.com/)
* [Make](https://www.gnu.org/software/make/)

Afterwards, building is straightforward.

```sh
git clone https://github.com/cs130-w22/Group-A3.git gradebetter
cd gradebetter
make
cd dist
./gradebetter
```

## Grading Scripts

Grading scripts are a core function of Gradebetter. Each assignment must have one,
Expand Down Expand Up @@ -82,13 +101,8 @@ fi
We can create an assignment with this grading script at an arbitary directory
`/home/gradebetter/grade_report.sh`. After ensuring that it is executable by
our Gradebetter user or the user the program is running under, we can use it
in our Gradebetter interface.

![]()

Then, we can upload some arbitrary submission to it:

![]()
in our Gradebetter interface. Then, we can upload some arbitrary submission
to it.

## Configuration

Expand All @@ -114,3 +128,33 @@ This project follows [semantic versioning](https://semver.org/), specifically th
2.0.0 spec. When the project receives a major version change, there will be
breaking changes. Backwards compatability will be provided in a best-effort in the
form of migratory scripts or utilities.

***

## Appendix: Diagrams

```mermaid
sequenceDiagram
actor User
User->>Handler: Upload work
activate Handler
Handler->>Runner: Run a job
activate Runner
Handler-->>User: OK
deactivate Handler
User->>Handler: Get live results
activate Handler
Handler->>Runner: Subscribe to job
loop for each test case
Runner-->>Handler: Result
Handler-->>User: Test case info
end
Runner->>DB: Writeback all results
activate DB
DB-->>Runner: Complete
deactivate DB
Runner-->>Handler: Final score
deactivate Runner
Handler-->>User: Terminate connection
deactivate Handler
```
12 changes: 5 additions & 7 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import (
)

var (
databaseFile string
secretKey string
port string
maxJobs uint
initializeTables bool
resetTables bool
databaseFile string
secretKey string
port string
maxJobs uint
resetTables bool
)

func main() {
Expand All @@ -33,7 +32,6 @@ func main() {
flag.StringVar(&port, "p", "8080", "`port` to serve the HTTP server on")
flag.StringVar(&secretKey, "k", "gradebetter", "secret `key` to use in JWT minting")
flag.UintVar(&maxJobs, "j", 1, "Maximum number of concurrent test scripts running at a given time")
flag.BoolVar(&initializeTables, "I", false, "Initialize SQLite schema then exit (if no prior database exists)")
flag.BoolVar(&resetTables, "D", false, "Reset SQLite database schema then exit (DROP ALL TABLES)")
flag.Parse()

Expand Down
24 changes: 17 additions & 7 deletions dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@
BUILD_DIR="./build"
GO_TAGS="sqlite_foreign_keys"

cd frontend
yarn
BUILD_PATH="../$BUILD_DIR/build" yarn build
cd ..
if [ ! $SKIP_FRONTEND ]; then
cd frontend
yarn
BUILD_PATH="../$BUILD_DIR/build" yarn build
cd ..
fi

cp README.md build/README.md
cp LICENSE build/LICENSE

for os in windows darwin linux; do
for arch in amd64 386 arm; do
cd backend
GOOS=$os GOARCH=$arch go build -o ../$BUILD_DIR/gradebetter --tags $GO_TAGS;
cd ..
tar czf "dist/gradebetter-$os-$arch.tar.gz" -C build/ .
GOOS=$os GOARCH=$arch go build -o ../$BUILD_DIR/gradebetter --tags $GO_TAGS
if [ $? -ne 0 ]; then
cd ..
continue
else
cd ..
tar czf "dist/gradebetter-$os-$arch.tar.gz" -C build/ .
fi
done
done

0 comments on commit 1e867e3

Please sign in to comment.