From 5ba2c43274d8123de9adada0040eacbb134ba834 Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 17:51:04 +0100 Subject: [PATCH 1/9] local code coverage --- .docker/Dockerfile_base_test_image | 14 ++++++++++++++ .docker/Dockerfile_code_coverage | 7 +++++++ .docker/Dockerfile_pre_test | 20 ++++---------------- .docker/Dockerfile_test | 3 ++- .docker/run_local_tests.sh | 11 ++++++++++- .gitignore | 1 + 6 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 .docker/Dockerfile_base_test_image create mode 100644 .docker/Dockerfile_code_coverage diff --git a/.docker/Dockerfile_base_test_image b/.docker/Dockerfile_base_test_image new file mode 100644 index 000000000..a29eac927 --- /dev/null +++ b/.docker/Dockerfile_base_test_image @@ -0,0 +1,14 @@ +FROM rust:1.58-buster + +RUN apt update +RUN apt install -y \ + libglib2.0-dev \ + libgtk-3-dev \ + libsoup2.4-dev \ + libappindicator3-dev \ + libwebkit2gtk-4.0-dev \ + firefox-esr \ + # for Tarpaulin code coverage + liblzma-dev binutils-dev libcurl4-openssl-dev libdw-dev libelf-dev + +CMD ["exit"] diff --git a/.docker/Dockerfile_code_coverage b/.docker/Dockerfile_code_coverage new file mode 100644 index 000000000..abcccb56d --- /dev/null +++ b/.docker/Dockerfile_code_coverage @@ -0,0 +1,7 @@ +FROM dioxus-test-image + +WORKDIR /run_test +RUN cargo install cargo-tarpaulin +RUN cargo cache -a + +ENTRYPOINT [ "bash" ] diff --git a/.docker/Dockerfile_pre_test b/.docker/Dockerfile_pre_test index 380bb5773..cc6f8810e 100644 --- a/.docker/Dockerfile_pre_test +++ b/.docker/Dockerfile_pre_test @@ -1,20 +1,8 @@ -FROM rust:1.58-buster +FROM dioxus-base-test-image -RUN apt update -RUN apt install -y \ - libglib2.0-dev \ - libgtk-3-dev \ - libsoup2.4-dev \ - libappindicator3-dev \ - libwebkit2gtk-4.0-dev \ - firefox-esr -# for kcov and Tarpaulin -#liblzma-dev binutils-dev libcurl4-openssl-dev libdw-dev libelf-dev - -RUN cargo install cargo-make --debug -# for test coverage -#RUN cargo install cargo-tarpaulin -# clean up a bit +RUN cargo install cargo-binstall +RUN cargo install cargo-make +RUN cargo install wasm-pack RUN cargo install cargo-cache && cargo cache -a CMD ["exit"] diff --git a/.docker/Dockerfile_test b/.docker/Dockerfile_test index f6265c2bb..4cd644051 100644 --- a/.docker/Dockerfile_test +++ b/.docker/Dockerfile_test @@ -1,8 +1,9 @@ -FROM dioxus-base-test-image +FROM dioxus-pre-test RUN mkdir run_test COPY tmp /run_test WORKDIR /run_test RUN cargo make tests +RUN cargo cache -a CMD ["exit"] diff --git a/.docker/run_local_tests.sh b/.docker/run_local_tests.sh index 4684625d4..ea37b5087 100644 --- a/.docker/run_local_tests.sh +++ b/.docker/run_local_tests.sh @@ -12,9 +12,18 @@ function run_script { rsync -a --progress ../ tmp --exclude target --exclude docker # build base image - docker build -f Dockerfile_pre_test -t dioxus-base-test-image . + docker build -f Dockerfile_base_test_image -t dioxus-base-test-image . + docker build -f Dockerfile_pre_test -t dioxus-pre-test . # run test docker build -f Dockerfile_test -t dioxus-test-image . + # code coverage + docker build -f Dockerfile_code_coverage -t dioxus-code-coverage . + + # exec test coverage + cd .. && \ + echo "rustup default nightly && cargo +nightly tarpaulin --verbose --all-features --tests --workspace --timeout 120 --out Html" | docker run -i --rm --security-opt seccomp=unconfined -v "/home/elios/project/prs/dioxus/:/run_test" dioxus-code-coverage + + firefox tarpaulin-report.html # clean up rm -rf tmp diff --git a/.gitignore b/.gitignore index 9df7e9f93..854f5cb26 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ Cargo.lock !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +tarpaulin-report.html \ No newline at end of file From ed0e03a036c5a1a8f72339b7e32a252cb169b4ba Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 18:14:19 +0100 Subject: [PATCH 2/9] new workflow --- .github/workflows/main.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 244313ef9..3d6687ae3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,3 +76,20 @@ jobs: with: command: clippy args: -- -D warnings + + coverage: + name: coverage + runs-on: ubuntu-latest + container: + image: xd009642/tarpaulin:develop-nightly + options: --security-opt seccomp=unconfined + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Generate code coverage + run: | + apt-get update &&\ + apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev &&\ + cargo +nightly tarpaulin --verbose --tests --all-features --workspace --timeout 120 --out Xml + - name: Upload to codecov.io + uses: codecov/codecov-action@v2 From 0ca1dcc32a99bf4c7b6c7fbb6e9bad9de922eea2 Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 18:15:54 +0100 Subject: [PATCH 3/9] fix workflow --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3d6687ae3..390cce21e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,7 +89,7 @@ jobs: - name: Generate code coverage run: | apt-get update &&\ - apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev &&\ + apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev -y &&\ cargo +nightly tarpaulin --verbose --tests --all-features --workspace --timeout 120 --out Xml - name: Upload to codecov.io uses: codecov/codecov-action@v2 From e295cc0b72fce451d4d122f0b5451a9255152443 Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 19:41:44 +0100 Subject: [PATCH 4/9] add wasm target --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 390cce21e..07664ba35 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,7 +78,7 @@ jobs: args: -- -D warnings coverage: - name: coverage + name: Coverage runs-on: ubuntu-latest container: image: xd009642/tarpaulin:develop-nightly @@ -90,6 +90,6 @@ jobs: run: | apt-get update &&\ apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev -y &&\ - cargo +nightly tarpaulin --verbose --tests --all-features --workspace --timeout 120 --out Xml + cargo +nightly tarpaulin --target wasm32-unknown-unknown --verbose --tests --all-features --workspace --timeout 120 --out Xml - name: Upload to codecov.io uses: codecov/codecov-action@v2 From 04bccef04b763b82f7c17e739345d67ae48ce328 Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 19:55:15 +0100 Subject: [PATCH 5/9] try fix --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07664ba35..46137cb75 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,6 +86,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - uses: jetli/wasm-pack-action@v0.3.0 - name: Generate code coverage run: | apt-get update &&\ From d8765464852413fef95c18e17733511475345743 Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 23:08:26 +0100 Subject: [PATCH 6/9] revert worklfow --- .docker/run_local_tests.sh | 4 ++-- .github/workflows/main.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.docker/run_local_tests.sh b/.docker/run_local_tests.sh index ea37b5087..396b7740b 100644 --- a/.docker/run_local_tests.sh +++ b/.docker/run_local_tests.sh @@ -21,9 +21,9 @@ function run_script { # exec test coverage cd .. && \ - echo "rustup default nightly && cargo +nightly tarpaulin --verbose --all-features --tests --workspace --timeout 120 --out Html" | docker run -i --rm --security-opt seccomp=unconfined -v "/home/elios/project/prs/dioxus/:/run_test" dioxus-code-coverage + echo "rustup default nightly && cargo +nightly tarpaulin --verbose --all-features --tests --workspace --exclude core-macro --timeout 120 --out Html" | docker run -i --rm --security-opt seccomp=unconfined -v "/home/elios/project/prs/dioxus/:/run_test" dioxus-code-coverage - firefox tarpaulin-report.html + #firefox tarpaulin-report.html # clean up rm -rf tmp diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46137cb75..83c79d61d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,6 +91,6 @@ jobs: run: | apt-get update &&\ apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev -y &&\ - cargo +nightly tarpaulin --target wasm32-unknown-unknown --verbose --tests --all-features --workspace --timeout 120 --out Xml + cargo +nightly tarpaulin --verbose --tests --all-features --workspace --timeout 120 --out Xml - name: Upload to codecov.io uses: codecov/codecov-action@v2 From fc0a093466ae3cdfd36f0e00f89c602010d9116e Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 23:27:24 +0100 Subject: [PATCH 7/9] try fix --- .docker/run_local_tests.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.docker/run_local_tests.sh b/.docker/run_local_tests.sh index 396b7740b..b6da68541 100644 --- a/.docker/run_local_tests.sh +++ b/.docker/run_local_tests.sh @@ -23,8 +23,6 @@ function run_script { cd .. && \ echo "rustup default nightly && cargo +nightly tarpaulin --verbose --all-features --tests --workspace --exclude core-macro --timeout 120 --out Html" | docker run -i --rm --security-opt seccomp=unconfined -v "/home/elios/project/prs/dioxus/:/run_test" dioxus-code-coverage - #firefox tarpaulin-report.html - # clean up rm -rf tmp if [ $# -ge 1 ] From ad2e39fb99e90af05b6230126f9aa662362b7c0e Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 23:35:47 +0100 Subject: [PATCH 8/9] try fix --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 83c79d61d..3d6687ae3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,7 +78,7 @@ jobs: args: -- -D warnings coverage: - name: Coverage + name: coverage runs-on: ubuntu-latest container: image: xd009642/tarpaulin:develop-nightly @@ -86,11 +86,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 - - uses: jetli/wasm-pack-action@v0.3.0 - name: Generate code coverage run: | apt-get update &&\ - apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev -y &&\ + apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev &&\ cargo +nightly tarpaulin --verbose --tests --all-features --workspace --timeout 120 --out Xml - name: Upload to codecov.io uses: codecov/codecov-action@v2 From 9e4dce282d6698fb75e84a7f28cce402090b135f Mon Sep 17 00:00:00 2001 From: t1m0t Date: Sun, 6 Feb 2022 23:43:33 +0100 Subject: [PATCH 9/9] try fix --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3d6687ae3..6b6f9be21 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,7 +78,7 @@ jobs: args: -- -D warnings coverage: - name: coverage + name: Coverage runs-on: ubuntu-latest container: image: xd009642/tarpaulin:develop-nightly @@ -89,7 +89,7 @@ jobs: - name: Generate code coverage run: | apt-get update &&\ - apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev &&\ + apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev -y &&\ cargo +nightly tarpaulin --verbose --tests --all-features --workspace --timeout 120 --out Xml - name: Upload to codecov.io uses: codecov/codecov-action@v2