Skip to content

Commit

Permalink
feat(dashboard): add daemon status & control [debian] (#54)
Browse files Browse the repository at this point in the history
feat(dashboard): add daemon status and control [debian]
  • Loading branch information
ivangabriele authored Jul 10, 2023
1 parent 11cb291 commit dbb1fe2
Show file tree
Hide file tree
Showing 91 changed files with 9,333 additions and 15,441 deletions.
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ trim_trailing_whitespace = false
indent_size = 4
max_line_length = 80

[*.xml]
trim_trailing_whitespace = false

[COMMIT_EDITMSG]
max_line_length = 0


[Makefile]
indent_size = 8
indent_style = tab
Expand Down
64 changes: 64 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage"]

assignees:
- ivangabriele

body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. [email protected]
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of our software are you running?
options:
- 1.0.2 (Default)
- 1.0.3 (Edge)
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com)
options:
- label: I agree to follow this project's Code of Conduct
required: true
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
node-version: 20
- name: Install
run: yarn
- name: Build
Expand All @@ -33,7 +33,7 @@ jobs:
# uses: actions/setup-node@v3
# with:
# cache: yarn
# node-version: 18
# node-version: 20
# - name: Install
# run: yarn
# - name: Build
Expand All @@ -51,7 +51,7 @@ jobs:
# uses: actions/setup-node@v3
# with:
# cache: yarn
# node-version: 18
# node-version: 20
# - name: Install
# run: yarn
# - name: Build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
# https://github.com/Swatinem/rust-cache#example-usage
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: integration_e2e_debian-latest
prefix-key: rust-cache
shared-key: v0
workspaces: "./src-tauri -> target"
workspaces: './src-tauri -> target'
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
node-version: 20
- name: Install ClamAV
run: |
apt-get update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# uses: actions/setup-node@v3
# with:
# cache: yarn
# node-version: 18
# node-version: 20
# - name: Install
# run: yarn
# - name: Build
Expand Down
34 changes: 24 additions & 10 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
node-version: 20
- name: Install
run: yarn
- name: Run
Expand All @@ -29,7 +29,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
node-version: 20
- name: Install
run: yarn
- name: Run
Expand All @@ -45,14 +45,15 @@ jobs:
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
node-version: 20
- name: Install Node.js dependencies
run: yarn
- name: Run
run: yarn test:unit:webview --coverage
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
flags: webview
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -67,14 +68,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
# https://github.com/Swatinem/rust-cache#example-usage
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: unit_core_test_debian-latest
prefix-key: rust-cache
shared-key: v0
workspaces: "./src-tauri -> target"
workspaces: './src-tauri -> target'
- name: Install ClamAV
run: |
apt-get update
Expand All @@ -85,13 +88,17 @@ jobs:
rustc -V
cargo -V
clamscan -V
- name: Run tests (with coverage)
run: cargo tarpaulin --no-fail-fast --out Xml --skip-clean --workspace
# https://github.com/tauri-apps/tauri/issues/3142
- name: Create fake /dist directory
run: mkdir ./dist
- name: Run unit tests (with coverage)
run: cargo tarpaulin --exclude glob --frozen --no-fail-fast --out Xml --workspace -- --nocapture
working-directory: ./src-tauri
- name: Upload tests coverage
uses: codecov/codecov-action@v3
with:
directory: ./src-tauri
fail_ci_if_error: true
flags: core
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -102,18 +109,22 @@ jobs:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
PROJECT_ROOT_PATH: ${{ matrix.os == 'macos-latest' && '/Users/runner/work/clamav-desktop/clamav-desktop' || 'D:\a\clamav-desktop\clamav-desktop' }}
PROJECT_ROOT_PATH:
${{ matrix.os == 'macos-latest' && '/Users/runner/work/clamav-desktop/clamav-desktop' ||
'D:\a\clamav-desktop\clamav-desktop' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
# https://github.com/Swatinem/rust-cache#example-usage
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: unit_core_test_${{ matrix.os }}
prefix-key: rust-cache
shared-key: v0
workspaces: "./src-tauri -> target"
workspaces: './src-tauri -> target'
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -122,11 +133,14 @@ jobs:
rustc -V
cargo -V
# clamscan -V
# https://github.com/tauri-apps/tauri/issues/3142
- name: Create fake /dist directory
run: mkdir ./dist
- name: Build
run: cargo build
working-directory: ./src-tauri
- name: Run tests
run: cargo test --no-fail-fast --workspace
run: cargo test --exclude glob --no-fail-fast --workspace -- --nocapture
working-directory: ./src-tauri

# webview_build:
Expand All @@ -143,7 +157,7 @@ jobs:
# uses: actions/setup-node@v3
# with:
# cache: yarn
# node-version: 18
# node-version: 20
# - name: Install Node.js dependencies
# run: yarn
# - name: Run
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ dist
########################################
# Custom

# Create React App build output
/build/*
# /clamav/build

# Yarn without Zero-Installs
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "clamav"]
path = clamav
url = https://github.com/Cisco-Talos/clamav.git
[submodule "src-tauri/glob"]
path = src-tauri/glob
url = https://github.com/rust-lang/glob.git
555 changes: 278 additions & 277 deletions .yarn/releases/yarn-3.5.0.cjs → .yarn/releases/yarn-3.6.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.5.0.cjs
yarnPath: .yarn/releases/yarn-3.6.0.cjs
34 changes: 25 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [Getting started](#getting-started)
- [Requirements](#requirements)
- [First setup](#first-setup)
- [1. Git (with submodule)](#1-git-with-submodule)
- [1. Git (with submodules)](#1-git-with-submodules)
- [2. Core with Tauri \& tauri-driver](#2-core-with-tauri--tauri-driver)
- [3. Webview with Yarn v3](#3-webview-with-yarn-v3)
- [4. Final Check](#4-final-check)
Expand All @@ -21,6 +21,8 @@
- [Style Guide \& Conventions](#style-guide--conventions)
- [Tests](#tests-1)
- [Commit messages](#commit-messages)
- [Recommended Editor/IDE Settings](#recommended-editoride-settings)
- [Visual Studio Code](#visual-studio-code)

## Personal Note

Expand Down Expand Up @@ -58,12 +60,12 @@ installation.
> ⚠️ **Important**
> If you're under **Windows**, you nust run all CLI commands under a Linux shell-like terminal (i.e.: WSL or Git Bash).
#### 1. Git (with submodule)
#### 1. Git (with submodules)

Then run:

```sh
git clone https://github.com/ivangabriele/clamav-desktop.git
git clone https://github.com/ivangabriele/clamav-desktop.git # or your fork
cd ./clamav-desktop
git submodule init
git submodule update
Expand All @@ -78,7 +80,6 @@ as well as [this one](https://tauri.app/v1/guides/testing/webdriver/ci/).
Once you're ready, you can run:

```sh
mkdir ./build
cd ./src-tauri
cp ./.cargo/config.toml.example ./.cargo/config.toml # and customize the content to match your local environment
cargo build
Expand All @@ -99,19 +100,24 @@ yarn
#### 4. Final Check

You should now be able to run `yarn dev` which will launch the application
(serving first the Webview on port 3000 and then launching the Core desktop app embedding this Webview).
(serving first the Webview on port 1420 and then launching the Core desktop app embedding this Webview).

#### 5. Optional requirements

- [cargo-watch](https://github.com/watchexec/cargo-watch#install) for `cargo watch` commands (i.e.: `make test-*-watch`)
- [ggshield](https://github.com/GitGuardian/ggshield#installation) for `yarn test:sec` command
- [cargo-deb](https://github.com/kornelski/cargo-deb#installation)
for debian bundle packaging.
- [cargo-edit](https://github.com/killercup/cargo-edit).
for `cargo upgrade`-related commands (i.e.: `make upgrade`)
- [cargo-watch](https://github.com/watchexec/cargo-watch#install)
for `cargo watch`-related commands (i.e.: `make test-*-watch`).
- [ggshield](https://github.com/GitGuardian/ggshield#installation)
for `yarn test:sec` command.

### Local run & development

This will watch for file changes and automatically re-hydrate the webapp on the go:

```sh
yarn dev:docker
yarn dev
```

Expand Down Expand Up @@ -166,7 +172,6 @@ yarn test:unit:webview

## Style Guide & Conventions


### Tests

For Rust unit tests, to avoid overwhelming main files with tests code, we follow
Expand Down Expand Up @@ -201,3 +206,14 @@ Our official scopes are:
- `config`: Any change impacting the Config screen
- `dashboard`: Any change impacting the Dashboard screen
- `scanner`: Any change impacting the Scanner screen

## Recommended Editor/IDE Settings

### Visual Studio Code

```json
{
"rust-analyzer.files.excludeDirs": [".git", ".yarn", "clamav", "target", "node_modules"],
"typescript.tsdk": "node_modules/typescript/lib"
}
```
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
test:
cd ./src-tauri && cargo test --no-fail-fast --workspace -- --nocapture
cd ./src-tauri && cargo test --exclude glob --no-fail-fast --workspace -- --nocapture
test-cover:
cd ./src-tauri && cargo tarpaulin --exclude glob --frozen --no-fail-fast --out Xml --workspace -- --nocapture
test-trace:
export RUST_BACKTRACE=1 && cd ./src-tauri && cargo test --no-fail-fast --workspace -- --nocapture
test-quiet:
Expand All @@ -26,3 +28,6 @@ test-jest:
cd ./src-tauri/jest && cargo test --no-fail-fast -- --nocapture
test-jest-watch:
cd ./src-tauri/jest && cargo watch -x "test -- --nocapture"

upgrade:
cd ./src-tauri && cargo upgrade --exclude glob
Loading

0 comments on commit dbb1fe2

Please sign in to comment.