Skip to content

Commit

Permalink
Dev (#15)
Browse files Browse the repository at this point in the history
* Cleanup Jitpack.io stuff

* Add BE url

* WIP: proper server configuration

* Implement Environment

* Add server configuration instructions

* Update CI workflows

* WIP: Setup tests

* WIP: Server e2e tests

* Working e2e test

* Fix the CI

* Add screenScope and DispatchersProvider

* WIP: Domain model
  • Loading branch information
ILIYANGERMANOV authored May 2, 2024
1 parent 8c39935 commit dc6deb9
Show file tree
Hide file tree
Showing 44 changed files with 624 additions and 469 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/build_android_debug.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/build_server.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/build_web.yml

This file was deleted.

90 changes: 90 additions & 0 deletions .github/workflows/ci_clients.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Clients CI

on:
push:
branches:
- main
pull_request:

jobs:
build_android_debug:
runs-on: ubuntu-latest
steps:
- name: Checkout GIT
uses: actions/checkout@v4

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'

- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Debug APK
run: ./gradlew :composeApp:assembleDebug

- name: Upload APK to Github Actions
uses: actions/upload-artifact@v4
with:
name: Ivy-Learn-Debug.apk
path: composeApp/build/outputs/apk/debug/composeApp-debug.apk

build_web_prod:
runs-on: ubuntu-latest
steps:
- name: Checkout GIT
uses: actions/checkout@v4

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'

- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Web distribution
run: ./gradlew :composeApp:jsBrowserDistribution

unit_test_clients:
runs-on: ubuntu-latest
steps:
- name: Checkout GIT
uses: actions/checkout@v4

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'

- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run unit tests
run: ./gradlew jvmTest

62 changes: 62 additions & 0 deletions .github/workflows/ci_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Server CI

on:
push:
branches:
- main
pull_request:

jobs:
build_test_server:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: ivy_learn
ports:
- 5432:5432
env:
IVY_LEARN_DB_HOST: localhost
IVY_LEARN_DB_DATABASE: ivy_learn
IVY_LEARN_DB_USER: postgres
IVY_LEARN_DB_PORT: 5432
IVY_LEARN_DB_PASSWORD: password
IVY_LEARN_GITHUB_PAT: ${{ secrets.IVY_LEARN_GITHUB_PAT }}
steps:
- name: Checkout GIT
uses: actions/checkout@v4

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'

- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Server
run: ./gradlew stage

- name: Start Server
run: |
chmod +x ./server/build/install/server/bin/server
./server/build/install/server/bin/server &
sleep 5
- name: Wait for the server to get ready
run: |
while ! nc -z localhost 8081; do sleep 1; done
- name: Run unit tests
run: ./gradlew server:test
1 change: 0 additions & 1 deletion .github/workflows/deploy_web_github_pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy Web app to GitHub Pages

on:
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/unit_test.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/unit_test_server.yml

This file was deleted.

30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,41 @@

Learn programming by thinking.

To run the web app:
**To run the web app:**

```
./scripts/runWebApp.sh
```

To run the desktop app:
**To run the desktop app:**

```
./scripts/runDesktopApp.sh
```

To run the sever:
## Server

You need to have a PostgreSQL database.

```
brew install postgresql
brew services start postgresql@14
psql -d ivy_learn -c "CREATE USER postgres WITH PASSWORD 'password';"
psql -d ivy_learn -c "ALTER USER postgres WITH SUPERUSER;"
```

**Environment Variables**

```zshrc
export IVY_LEARN_DB_HOST="localhost"
export IVY_LEARN_DB_DATABASE="ivy_learn"
export IVY_LEARN_DB_USER="postgres"
export IVY_LEARN_DB_PORT="5432"
export IVY_LEARN_DB_PASSWORD="password"
export IVY_LEARN_GITHUB_PAT="your_github_personal_access_token"
```

**To run the sever:**

```
./scripts/runServer.sh
Expand Down
Loading

0 comments on commit dc6deb9

Please sign in to comment.