Skip to content

Commit 7aedd1a

Browse files
chore: Improve test coverage (#208)
* feat: tighten testing, and frame hygiene * remove unnecessary imports in bindings * update release-plz config * update pr-title filter * trigger bindings ci * chore(codegen): update bevy bindings (#209) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Improve UI for adding intiializers and add docs, correct initialization of lua plugins * remove some unnecessary optionals * report coverage * remove failing todo * set error settings * fix workflow syntax * run after check and bump versions * actually include coverage in the run * install genhtml * actually use the right path and only upload coverage from ubuntu * change profile for coverage runs * move coverage gen into the matrix * output coverage in the matrix * improve comments slightly, and make global contexts work * refactor asset systems, make use of internal script asset events * add simple error test * remove inactive docs code * improve docs * add reflect reference tests * update report command * include coverage badge as test * increase badge width and update badge on commit * force badge re-creation * add more tests to printing and conversions * update workflow permissions * update coverage badge on main only * fix test and stop ignoring things * ignore bevy bindings from coverage --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 614431f commit 7aedd1a

File tree

38 files changed

+2496
-1238
lines changed

38 files changed

+2496
-1238
lines changed

.github/workflows/bevy_mod_scripting.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
check:
4747
permissions:
4848
pull-requests: write
49+
contents: write
4950
name: Check - ${{ matrix.run_args.name }}
5051
runs-on: ${{ matrix.run_args.os }}
5152
# container: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
@@ -57,6 +58,7 @@ jobs:
5758
steps:
5859
- name: Checkout
5960
uses: actions/checkout@v4
61+
6062
- name: Install alsa and udev
6163
if: runner.os == 'linux'
6264
run: |
@@ -66,11 +68,35 @@ jobs:
6668
with:
6769
toolchain: stable
6870
override: true
71+
6972
- name: Rust Cache
7073
uses: Swatinem/[email protected]
74+
7175
- name: Setup
7276
run: |
7377
cargo xtask init
78+
7479
- name: Check
7580
run: |
76-
${{ matrix.run_args.command }}
81+
${{ matrix.run_args.command }}
82+
83+
- name: Upload coverage artifact
84+
if: ${{ matrix.run_args.generates_coverage }}
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: code-coverage-report
88+
path: target/coverage/html/
89+
90+
- name: Update coverage badge
91+
if: ${{ matrix.run_args.generates_coverage && github.ref == 'refs/heads/main' }}
92+
run: |
93+
cp target/coverage/html/badges/for_the_badge.svg badges/coverage.svg
94+
95+
git config user.name "github-actions[bot]"
96+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
97+
git add badges/coverage.svg
98+
99+
if [[ -n $(git status -s) ]]; then
100+
git commit -m "chore(badge): Update coverage badge" -m "[skip ci]"
101+
git push
102+
fi

.github/workflows/generate_bindings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
BRANCH_NAME: __update-bevy-bindings-${{ github.head_ref || github.ref_name }}
1414
GH_TOKEN: ${{ github.token }}
1515

16+
1617
jobs:
1718
generate_bindings:
1819
permissions:

.github/workflows/pr-titles.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ jobs:
2323
types: |
2424
fix
2525
feat
26-
chore
26+
chore
27+
test
28+
docs

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ codegen-units = 8
105105
incremental = false
106106
debug = false
107107

108+
[profile.ephemeral-coverage]
109+
inherits = "ephemeral-build"
110+
debug = true
111+
108112
[profile.release-with-debug]
109113
inherits = "release"
110114
debug = true

badges/coverage.svg

Lines changed: 13 additions & 0 deletions
Loading

crates/bevy_api_gen/templates/header.tera

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use super::{{crate}}::*;
1010

1111

1212
use bevy_mod_scripting_core::{
13-
AddContextInitializer,
14-
StoreDocumentation,
1513
bindings::{
1614
ReflectReference,
1715
function::{from::{Ref, Mut, Val}, namespace::{NamespaceBuilder}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello world
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test script

0 commit comments

Comments
 (0)