Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lupari committed Sep 27, 2024
2 parents 0f562f7 + 8b026f0 commit 1bbfe03
Show file tree
Hide file tree
Showing 729 changed files with 43,984 additions and 57,437 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build

on: [push]

jobs:
build:

runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_DB: exam_test
POSTGRES_USER: exam
POSTGRES_PASSWORD: exam
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Build UI
run: |
rm -rf node_modules
npm i
npm run check-format
npm run check-lint
npm run build
- name: Build backend and run tests
run: |
sed -i 's/\/var\/log\/exam/logs/g' $GITHUB_WORKSPACE/conf/logback.xml
sbt test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ target
default-drop-all.sql
default-create-all.sql
/data/
.angular
.angular
dist
6 changes: 6 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rules = [DisableSyntax, OrganizeImports, RedundantSyntax]
OrganizeImports {
removeUnused = false
groupedImports = Keep
coalesceToWildcardImportThreshold = 3
}
6 changes: 4 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
align = more
maxColumn = 100
version = "3.7.7"
runner.dialect = scala3
align.preset = more
maxColumn = 120
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

75 changes: 14 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,36 @@
[![Build Status](https://api.travis-ci.com/CSCfi/exam.svg?branch=master)](https://app.travis-ci.com/github/CSCfi/exam)
[![Build](https://github.com/CSCfi/exam/actions/workflows/scala.yml/badge.svg?branch=dev)](https://github.com/CSCfi/exam/actions)

EXAM Quickstart for developers
=====================================

1. Prerequisites: install SBT, Java (11), Node (>= 14) and PostgreSQL (>= 9.4).
1. Prerequisites: install SBT, Java (21), Node (>= 18) and PostgreSQL (>= 9.4).

2. Create PostgreSQL database

$ createuser -SPRD sitnet
$ createdb sitnet --owner=sitnet
$ createuser -SPRD exam
$ createdb exam --owner=exam

For tests

$ createdb sitnet_test --owner=sitnet

For protractor

$ createdb sitnet_protractor --owner=sitnet
$ createdb exam_test --owner=exam

Requires that you have pg_hba.conf set up to accept local connections etc.
Note that you can configure database related parameters (and others) in the dev config file (conf/dev.conf)

3. Get frontend dependencies

$ cd ui
$ npm install

4. Start sbt console

$ cd ..
$ sbt -Dconfig.file=conf/dev.conf -jvm-debug 9999
Note that you can configure database related parameters (and others) in the dev config file (/conf/dev.conf)

This opens up a debug port at 9999 and starts up webpack dev server at 8080. You can run webpack server independent of
sbt by passing the following build parameter
3. Get frontend dependencies and start frontend application in development mode

$ sbt -Dconfig.file=conf/dev.conf -DwithoutWebpackServer=true
$ npm install
$ npm start

in which case you can manage the server yourself in a separate terminal like this

$ cd ui
$ npm start

5. Inside sbt console start the app
4. In another tab or window start sbt console and run backend application in development mode

$ sbt -Dconfig.file=conf/dev.conf -jvm-debug 9999 -mem 2048
[exam] $ run

6. Open http://localhost:9000 in your browser
Accept the database migrations in case you see a prompt.

## Skipping Karma and Protractor tests

You can skip running UI tests by passing the following build parameter

$ sbt -Dconfig.file=conf/dev.conf -DskipUiTests=true
This opens up a debug port at 9999 and allocates 2 Gb of heap memory for the JVM.

in which case the tests will not be executed after starting the app.

## Running Protractor tests with SBT

You can run protractor tests with sbt build using following command:

$sbt run -Dconfig.resource=protractor.conf

### Passing parameters to protractor

You can pass parameters to protractor using _protractor.args_ property.
Passing multiple protractor parameters use comma (,) to separate parameters.

-Dprotractor.args=--capabilities.browserName=firefox,--troubleshoot

For example running specific test spec only:

$sbt run -Dconfig.resource=protractor.conf -Dprotractor.args=--specs=protractor/e2e/teacher-exam-spec.js

## Running Protractor tests in CI

Using CI specific protractor configuration.

$sbt run -Dconfig.resource=protractor.conf -Dprotractor.config=ciConf.js
5. Open http://localhost:4200 in your browser.
Accept the database migrations in case you see a prompt.

## More information
For more information see [official installation instructions](https://wiki.eduuni.fi/display/CSCEXAM/Asennusohjeet) (in Finnish only)
Expand Down
69 changes: 27 additions & 42 deletions ui/angular.json → angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,44 @@
}
},
"root": "",
"sourceRoot": "src",
"sourceRoot": "ui/src",
"prefix": "xm",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/exam",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"index": "ui/src/index.html",
"main": "ui/src/main.ts",
"polyfills": "ui/src/polyfills.ts",
"tsConfig": "ui/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"assets": ["ui/src/favicon.ico", "ui/src/assets"],
"styles": ["ui/src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "2.1mb"
"maximumWarning": "2.2mb",
"maximumError": "2.3mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
"maximumError": "5kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"replace": "ui/src/environments/environment.ts",
"with": "ui/src/environments/environment.prod.ts"
},
{
"replace": "src/app/interceptors/auth-interceptor.ts",
"with": "src/app/interceptors/auth-interceptor.prod.ts"
"replace": "ui/src/app/interceptors/auth-interceptor.ts",
"with": "ui/src/app/interceptors/auth-interceptor.prod.ts"
}
],
"outputHashing": "all",
Expand All @@ -76,59 +71,49 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "exam:build",
"proxyConfig": "src/proxy.conf.js"
"proxyConfig": "ui/src/proxy.conf.js",
"buildTarget": "exam:build"
},
"configurations": {
"production": {
"browserTarget": "exam:build:production"
"buildTarget": "exam:build:production"
},
"development": {
"browserTarget": "exam:build:development"
"buildTarget": "exam:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "exam:build"
"buildTarget": "exam:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"main": "ui/src/test.ts",
"polyfills": "ui/src/polyfills.ts",
"tsConfig": "ui/tsconfig.spec.json",
"karmaConfig": "ui/karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"assets": ["ui/src/favicon.ico", "ui/src/assets"],
"styles": ["ui/src/styles.scss"],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
"lintFilePatterns": ["ui/src/**/*.ts", "ui/src/**/*.html"]
}
}
}
}
},
"cli": {
"schematicCollections": [
"@angular-eslint/schematics"
],
"schematicCollections": ["@angular-eslint/schematics"],
"analytics": false
},
"schematics": {
Expand Down
Loading

0 comments on commit 1bbfe03

Please sign in to comment.