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

add unit test setup for cubit tests #430

Merged
merged 10 commits into from
Dec 23, 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
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
# FLUTTER_VERSION: "2.5.3"
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-23.11
#- uses: actions/setup-java@v1
# with:
# java-version: $
Expand All @@ -40,6 +43,8 @@ jobs:
- run: ./submodules/flutter/bin/flutter pub get
- run: ./submodules/flutter/bin/dart format --output=none --set-exit-if-changed ./lib
- run: ./submodules/flutter/bin/dart analyze ./lib
- name: Run tests with nix (starts postgres and invidious server)
run: nix-shell --run './submodules/flutter/bin/flutter test'
- run: ./submodules/flutter/bin/flutter pub run flutter_native_splash:create
- run: ./submodules/flutter/bin/flutter build apk --profile --split-per-abi
- name: Archive build artifacts
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ app.*.map.json
/android/app/profile
/android/app/release
/docker/result
/.nix-shell/
/nix/result/
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,33 @@ git submodule update
#enable git pre commit hooks for auto formatting
./submodules/flutter/bin/dart run tools/setup_git_hooks.dart
```
or using nix that will handle all the above plus starting a working invidious instance with user test and password test.
```
nix-shell
```
Flutter itself is used as a submodule of this repo in order to pin the version I want to use to enable reproducible build on f-droid

You'll need to also set up your android SDK and a device / emulator to run the app on.

#### Tests

The app has some tests and they expect to have a locally running invidious server, with a test user (password test).

The easy way it to use [nix](https://nixos.org) and run

```
nix-shell
```

That will spin a postgres DB, an invidious server and the required user (this is how the tests are run in the ci/cd).

Nothing keeps you to run your own user docker or other ways.

Alternatively, you can directly run the tests with its environment:
```
nix-shell --run './submodules/flutter/bin/flutter test'
```

### Translations

![Translation status](https://hosted.weblate.org/widgets/clipious/-/app-translation/multi-auto.svg)
Expand Down
Loading