Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile setup #34

Merged
merged 18 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ env:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./command
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose --manifest-path command/Cargo.toml
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose --manifest-path command/Cargo.toml
run: cargo test --verbose
- name: Clippy
run: cargo clippy --all -- -D warnings
- name: Check formatting
run: cargo fmt --manifest-path command/Cargo.toml -- --check
run: cargo fmt -- --check
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
command/.cargo
command/repos
command/target

settings.env
settings.toml
55 changes: 49 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,13 @@ docker compose run --rm -w /scalachess --entrypoint="sbt package" lila

```bash
## run formatter
docker run --rm -v $(pwd)/repos/dartchess:/mnt --workdir /mnt dart:3.1.5-sdk \
dart format .
docker compose run --rm -w /dartchess mobile dart format .

## analyze
docker run --rm -v $(pwd)/repos/dartchess:/mnt --workdir /mnt dart:3.1.5-sdk \
bash -c "dart pub get && dart analyze"
docker compose run --rm -w /dartchess mobile bash -c "dart pub get && dart analyze"

## run tests
docker run --rm -v $(pwd)/repos/dartchess:/mnt --workdir /mnt dart:3.1.5-sdk \
bash -c "dart pub get && dart test -x full_perft"
docker compose run --rm -w /dartchess mobile bash -c "dart pub get && dart test -x full_perft"
```

### bbpPairings:
Expand Down Expand Up @@ -247,3 +244,49 @@ curl --get http://localhost:8086/query \
--data-urlencode "db=kamon" \
--data-urlencode "q=show measurements;"
```

### Mobile

1. On your Android phone:
1. Connect your phone to the same wifi network as your host machine
2. Enable Developer Mode
3. In Developer Options, enable Wireless Debugging and tap into its menu
2. On your host machine:

1. Have the lila-docker services running, with the `Mobile` optional service started
2. Configure lila to run with your host's IP address or hostname instead of localhost

```bash
./lila-docker hostname
```

- Then verify that your phone can access the site at `http://[your-selection]:8080`

3. Connect to your phone

```bash
./lila-docker mobile
```

4. Get a shell on the container:

```bash
docker compose exec -it mobile bash

# verify your phone is listed
adb devices
```

5. Install the app dependencies:
```bash
flutter pub get
dart run build_runner build
```
6. Run the app:
```bash
flutter run -v \
--dart-define LICHESS_HOST=$LILA_URL \
--dart-define LICHESS_WS_HOST=$LILA_URL
```
- No substitutions necessary. The `$LILA_URL` environment variable will already be set on the container.
- First time you run it, it might take a while
Loading