From b8e6f9333a16f71cc929531e252133517d1623cd Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 16:46:30 +0000 Subject: [PATCH 01/21] chore: make CI/CD compile --- .github/workflows/bevy_mod_scripting.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 6b502d51b1..6bf5b6bb67 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -26,6 +26,8 @@ jobs: outputs: matrix: ${{ steps.generate-matrix.outputs.matrix }} steps: + - name: Checkout + uses: actions/checkout@v4 - name: Generate matrix id: generate-matrix run: | From 21b6f17809dd4c474f619c83b5b21d6620a0f855 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 16:50:03 +0000 Subject: [PATCH 02/21] update commit parsers for release plz --- release-plz.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/release-plz.toml b/release-plz.toml index a13e3450b6..4de4baff86 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -3,6 +3,16 @@ dependencies_update = false publish_timeout = "30m" git_release_enable = false git_tag_enable = false +commit_parsers = [ + { message = "^feat", group = "added" }, + { message = "^changed", group = "changed" }, + { message = "^deprecated", group = "deprecated" }, + { message = "^fix", group = "fixed" }, + { message = "^security", group = "security" }, + { message = "^.*", group = "other" }, + # dont include chore changes in changelog + { message = "^chore.*", skip = true }, +] [[package]] name = "bevy_mod_scripting" From 63b30600e4e23b4e61f945ac3beabcd0899d5cb2 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:01:41 +0000 Subject: [PATCH 03/21] print the output --- .github/workflows/bevy_mod_scripting.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 6bf5b6bb67..3dbafb85e6 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -31,7 +31,9 @@ jobs: - name: Generate matrix id: generate-matrix run: | - echo "matrix=$(cargo xtask ci-matrix)" >> $GITHUB_OUTPUT + cargo xtask ci-matrix > matrix.json + cat matrix.json + echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT check: permissions: From dec0187421ecb4b787b321980bcbce4073e7653a Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:05:08 +0000 Subject: [PATCH 04/21] fix line issues --- .github/workflows/bevy_mod_scripting.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 3dbafb85e6..447b7bf944 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -33,6 +33,8 @@ jobs: run: | cargo xtask ci-matrix > matrix.json cat matrix.json + echo "Convert to single line JSON" + jq -c . matrix.json > matrix.json echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT check: From c0eb8fadb39aaa1086001b28e5b5d4a58fbef969 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:11:14 +0000 Subject: [PATCH 05/21] Print a bit more --- .github/workflows/bevy_mod_scripting.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 447b7bf944..1badafa51a 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -36,6 +36,9 @@ jobs: echo "Convert to single line JSON" jq -c . matrix.json > matrix.json echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT + - name: Print uploaded matrix + run: | + echo "${{ steps.generate-matrix.outputs.matrix }}" check: permissions: From 50aa42782473b37b1f88994911380c99b746e004 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:17:16 +0000 Subject: [PATCH 06/21] fix jq command --- .github/workflows/bevy_mod_scripting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 1badafa51a..acd2c6c975 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -34,8 +34,8 @@ jobs: cargo xtask ci-matrix > matrix.json cat matrix.json echo "Convert to single line JSON" - jq -c . matrix.json > matrix.json - echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT + jq -c . matrix.json > matrix-one-line.json + echo "matrix=$(cat matrix-one-line.json)" >> $GITHUB_OUTPUT - name: Print uploaded matrix run: | echo "${{ steps.generate-matrix.outputs.matrix }}" From ac38f7a14ee0b0478e0bce4e2372dfdbceb51f44 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:21:33 +0000 Subject: [PATCH 07/21] fix command --- .github/workflows/bevy_mod_scripting.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index acd2c6c975..08c815986c 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -63,7 +63,9 @@ jobs: override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 - - uses: actions-rs/cargo@v1 - with: - command: ${{ matrix.run_args.command }} - args: ci-check \ No newline at end of file + - name: Setup + run: | + cargo xtask init + - name: Check + run: | + ${{ matrix.run_args.command }} \ No newline at end of file From cd6488350043ef2685fd61249021b58451f5563c Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:29:41 +0000 Subject: [PATCH 08/21] Improve display names for actions and fix short name for subcommand --- crates/xtask/src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index b41406404e..baebacaa32 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -281,7 +281,12 @@ impl App { pub(crate) fn into_ci_row(self, os: String) -> CiMatrixRow { CiMatrixRow { command: self.clone().into_command_string().into_string().unwrap(), - name: format!("{} - {}", self.subcmd.as_ref(), self.global_args.features), + name: format!( + "{}({}) - {}", + self.subcmd.as_ref(), + os, + self.global_args.features + ), os, } } @@ -393,7 +398,7 @@ enum Xtasks { package: Option, /// Run tests without coverage - #[clap(long, short)] + #[clap(long, short = "nc")] no_coverage: bool, }, /// Perform a full check as it would be done in CI, except not parallelised From 64d46b12fcbd727132cb9bd334b24e78516688e1 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:42:43 +0000 Subject: [PATCH 09/21] fix invalid default feature, and remove short option for subcommand --- Cargo.toml | 4 ++-- crates/xtask/Dockerfile | 0 crates/xtask/src/main.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 crates/xtask/Dockerfile diff --git a/Cargo.toml b/Cargo.toml index aabd435120..08c7f331e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,10 +20,10 @@ path = "src/lib.rs" features = ["lua54"] [features] -default = ["core_functions", "bevy_bindings", "unsafe_lua_modules"] +default = ["core_functions", "bevy_bindings"] ## lua -lua = ["bevy_mod_scripting_lua"] +lua = ["bevy_mod_scripting_lua", "unsafe_lua_modules"] # one of these must be selected lua51 = ["bevy_mod_scripting_lua/lua51", "lua"] lua52 = ["bevy_mod_scripting_lua/lua52", "lua"] diff --git a/crates/xtask/Dockerfile b/crates/xtask/Dockerfile new file mode 100644 index 0000000000..e69de29bb2 diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index baebacaa32..e135c86ccb 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -398,7 +398,7 @@ enum Xtasks { package: Option, /// Run tests without coverage - #[clap(long, short = "nc")] + #[clap(long)] no_coverage: bool, }, /// Perform a full check as it would be done in CI, except not parallelised From 11784b14cab906d8074551e24ee1a4ce70a442c7 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:47:19 +0000 Subject: [PATCH 10/21] don't print matrix anymore --- .github/workflows/bevy_mod_scripting.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 08c815986c..957682b49d 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -36,9 +36,6 @@ jobs: echo "Convert to single line JSON" jq -c . matrix.json > matrix-one-line.json echo "matrix=$(cat matrix-one-line.json)" >> $GITHUB_OUTPUT - - name: Print uploaded matrix - run: | - echo "${{ steps.generate-matrix.outputs.matrix }}" check: permissions: From 73808c56a44c950b432309f7e6e81d92431ae635 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 17:55:02 +0000 Subject: [PATCH 11/21] remove short options --- crates/xtask/src/main.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index e135c86ccb..e6a664e070 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -360,7 +360,6 @@ enum Xtasks { Check { #[clap( long, - short, default_value = "false", help = "Run in the expected format for rust-analyzer's override check command" )] @@ -368,7 +367,6 @@ enum Xtasks { #[clap( long, - short, default_value = "all", value_parser=clap::value_parser!(CheckKind), value_name=CheckKind::to_placeholder(), @@ -380,21 +378,21 @@ enum Xtasks { Docs { /// Open in browser /// This will open the generated docs in the default browser - #[clap(long, short)] + #[clap(long)] open: bool, /// Skip building rust docs - #[clap(long, short)] + #[clap(long)] no_rust_docs: bool, }, /// Build the main workspace, and then run all tests Test { /// Run tests containing the given name only - #[clap(long, short)] + #[clap(long)] name: Option, /// Run tests in the given package only - #[clap(long, short)] + #[clap(long)] package: Option, /// Run tests without coverage From 81ab9d4eb620dcdbdeecf536dad48370e23635eb Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 18:25:53 +0000 Subject: [PATCH 12/21] try build docker image --- .github/workflows/bevy_mod_scripting.yml | 37 ++++++++++++++++++++++++ crates/xtask/Dockerfile | 19 ++++++++++++ 2 files changed, 56 insertions(+) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 957682b49d..c9b4847961 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -13,6 +13,12 @@ on: name: Check and Lint - bevy_mod_scripting + +env: + + REGISTRY: ghcr.io + IMAGE_NAME: bevy-mod-scripting + concurrency: # Use github.run_id on main branch # Use github.event.pull_request.number on pull requests, so it's unique per pull request @@ -21,6 +27,37 @@ concurrency: cancel-in-progress: true jobs: + + build-ci-image: + runs-on: ubuntu-latest + # if: github.ref == 'refs/heads/main' || github.ref == 'staging' + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + file: ./crates/xtask/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + generate-job-matrix: runs-on: ubuntu-latest outputs: diff --git a/crates/xtask/Dockerfile b/crates/xtask/Dockerfile index e69de29bb2..11ef450f06 100644 --- a/crates/xtask/Dockerfile +++ b/crates/xtask/Dockerfile @@ -0,0 +1,19 @@ +FROM rust:latest AS base +RUN cargo install sccache --version ^0.7 +RUN cargo install cargo-chef --version ^0.1 +ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache + +FROM base AS planner +WORKDIR /app +COPY . . +RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ + cargo chef prepare --recipe-path recipe.json + +FROM base as builder +WORKDIR /app +COPY --from=planner /app/recipe.json recipe.json +RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ + cargo chef cook --release --recipe-path recipe.json +COPY . . +RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ + cargo xtask init \ No newline at end of file From 8ac21c90c998d6719b78f63a4f91f6a87f1cf2c9 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 18:34:42 +0000 Subject: [PATCH 13/21] fix tag --- .github/workflows/bevy_mod_scripting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index c9b4847961..d64ebff2a1 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -48,7 +48,7 @@ jobs: id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: From 630a0b91d364c4288680459f2129cb1a58710750 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 18:40:14 +0000 Subject: [PATCH 14/21] leave docker for now --- .github/workflows/bevy_mod_scripting.yml | 31 ------------------------ 1 file changed, 31 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index d64ebff2a1..92eafe6d36 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -27,37 +27,6 @@ concurrency: cancel-in-progress: true jobs: - - build-ci-image: - runs-on: ubuntu-latest - # if: github.ref == 'refs/heads/main' || github.ref == 'staging' - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Log into registry ${{ env.REGISTRY }} - if: github.event_name != 'pull_request' - uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - file: ./crates/xtask/Dockerfile - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - generate-job-matrix: runs-on: ubuntu-latest outputs: From dc446d606f49c74a49d1ff104e474c237719c230 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 18:51:57 +0000 Subject: [PATCH 15/21] fix into command not taking into account features --- crates/xtask/src/main.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index e6a664e070..6c816e489d 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -107,6 +107,12 @@ impl IntoFeatureGroup for Feature { #[derive(Debug, Clone, PartialEq, Eq)] struct Features(HashSet); +impl Default for Features { + fn default() -> Self { + Features::new(vec![Feature::Lua54]) + } +} + impl Features { fn new>(features: I) -> Self { Self(features.into_iter().collect()) @@ -207,6 +213,16 @@ impl App { fn into_command(self) -> Command { let mut cmd = Command::new("cargo"); cmd.arg("xtask"); + + if self.global_args.features != Features::default() { + cmd.arg("--features") + .arg(self.global_args.features.to_string()); + } + + if let Some(profile) = self.global_args.profile { + cmd.arg("--profile").arg(profile); + } + match self.subcmd { Xtasks::Macros { macro_name } => { cmd.arg("macros").arg(macro_name.as_ref()); @@ -294,7 +310,7 @@ impl App { #[derive(Debug, Parser, Clone)] struct GlobalArgs { - #[clap(long, short, global = true, value_parser=clap::value_parser!(Features), value_name=Features::to_placeholder(), default_value="lua54",required = false)] + #[clap(long, short, global = true, value_parser=clap::value_parser!(Features), value_name=Features::to_placeholder(), default_value=Features::default().to_string(),required = false)] features: Features, #[clap( From d7b9b16cb3b046c348069138cd8060464a767c73 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 19:43:40 +0000 Subject: [PATCH 16/21] fix various problems --- crates/xtask/src/main.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 6c816e489d..868ac1b9f7 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -167,9 +167,6 @@ impl Features { impl std::fmt::Display for Features { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - if &Self::all_features() == self { - return write!(f, "all"); - } for (i, feature) in self.0.iter().sorted().enumerate() { if i > 0 { write!(f, ",")?; @@ -298,10 +295,14 @@ impl App { CiMatrixRow { command: self.clone().into_command_string().into_string().unwrap(), name: format!( - "{}({}) - {}", + "{}({}) - {}", self.subcmd.as_ref(), os, - self.global_args.features + if self.global_args.features == Features::all_features() { + "all features".to_owned() + } else { + self.global_args.features.to_string() + } ), os, } @@ -473,22 +474,25 @@ impl Xtasks { // we don't need to verify all feature flags on all platforms, this is mostly a "does it compile" check // for finding out missing compile time logic or bad imports multi_os_steps - .retain(|e| !e.command.contains("build") && !e.command.contains("docs")); + .retain(|e| !e.command.contains(" build") && !e.command.contains(" docs")); let mut macos_matrix = multi_os_steps.clone(); let mut windows_matrix = multi_os_steps.clone(); for row in macos_matrix.iter_mut() { row.os = "macos-latest".to_owned(); + row.name = row.name.replace("ubuntu-latest", "macos-latest"); } for row in windows_matrix.iter_mut() { row.os = "windows-latest".to_owned(); + row.name = row.name.replace("ubuntu-latest", "windows-latest"); } matrix.extend(macos_matrix); matrix.extend(windows_matrix); + matrix.sort_by_key(|e| e.name.to_owned()); let json = serde_json::to_string_pretty(&matrix)?; return Ok(json); } From bc4041a44857deedc3fd2149ff0758e0223e463b Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 20:05:25 +0000 Subject: [PATCH 17/21] fix luau compile error --- .../bevy_mod_scripting_lua/src/bindings/script_value.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index f97bd6df1d..5cff90c267 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -41,7 +41,10 @@ impl FromLua for LuaScriptValue { Value::Nil => ScriptValue::Unit, Value::Boolean(b) => ScriptValue::Bool(b), // Value::LightUserData(light_user_data) => todo!(), + #[cfg(not(feature = "luau"))] Value::Integer(i) => ScriptValue::Integer(i), + #[cfg(feature = "luau")] + Value::Integer(i) => ScriptValue::Integer(i as i64), Value::Number(n) => ScriptValue::Float(n), Value::String(s) => ScriptValue::String(s.to_str()?.to_owned().into()), Value::Table(table) => { From 9fe73dbef20de60a640f62efdca5fd5d974e25be Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 20:25:35 +0000 Subject: [PATCH 18/21] fix luau and try docker again --- .github/workflows/bevy_mod_scripting.yml | 44 ++++++++++++++++++- .../src/bindings/script_value.rs | 3 ++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 92eafe6d36..442b39a090 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -15,7 +15,6 @@ name: Check and Lint - bevy_mod_scripting env: - REGISTRY: ghcr.io IMAGE_NAME: bevy-mod-scripting @@ -27,8 +26,46 @@ concurrency: cancel-in-progress: true jobs: + build-runner-image: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + build-with-docker: + name: Build multi-platform Docker image + runs-on: ubuntu-20.04 + outputs: + image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v5 + with: + context: . + file: ./crates/xtask/Dockerfile + platforms: linux/amd64,linux/arm64,windows/amd64 + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + generate-job-matrix: + needs: build-runner-image runs-on: ubuntu-latest + container: ${{ needs.build-runner-image.outputs.image }} outputs: matrix: ${{ steps.generate-matrix.outputs.matrix }} steps: @@ -48,7 +85,10 @@ jobs: pull-requests: write name: Check - ${{ matrix.run_args.name }} runs-on: ${{ matrix.run_args.os }} - needs: generate-job-matrix + container: ${{ needs.build-runner-image.outputs.image }} + needs: + - generate-job-matrix + - build-runner-image strategy: matrix: run_args: ${{fromJson(needs.generate-job-matrix.outputs.matrix)}} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 5cff90c267..7666f6779d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -89,7 +89,10 @@ impl IntoLua for LuaScriptValue { Ok(match self.0 { ScriptValue::Unit => Value::Nil, ScriptValue::Bool(b) => Value::Boolean(b), + #[cfg(not(feature = "luau"))] ScriptValue::Integer(i) => Value::Integer(i), + #[cfg(feature = "luau")] + ScriptValue::Integer(i) => Value::Integer(i as i32), ScriptValue::Float(f) => Value::Number(f), ScriptValue::String(s) => Value::String(lua.create_string(s.as_ref())?), ScriptValue::Reference(r) => LuaReflectReference::from(r).into_lua(lua)?, From 41faf0e89e7e99a0457908c3e8ae3c86ef1e23fe Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 20:26:47 +0000 Subject: [PATCH 19/21] typo --- .github/workflows/bevy_mod_scripting.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 442b39a090..c0263b34a2 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -31,9 +31,7 @@ jobs: contents: read packages: write runs-on: ubuntu-latest - build-with-docker: name: Build multi-platform Docker image - runs-on: ubuntu-20.04 outputs: image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} steps: From 25fb6ff5c0bcbb1c292ef34b77aa47824cecfac5 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 20:34:08 +0000 Subject: [PATCH 20/21] try without windows platform --- .github/workflows/bevy_mod_scripting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index c0263b34a2..a3e7f73980 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -54,7 +54,7 @@ jobs: with: context: . file: ./crates/xtask/Dockerfile - platforms: linux/amd64,linux/arm64,windows/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max tags: ${{ steps.meta.outputs.tags }} From a2f063e9d3d61d227d52315b81624e23b8782eed Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 13 Jan 2025 21:43:15 +0000 Subject: [PATCH 21/21] move docker image creation to its own action --- .github/workflows/bevy_mod_scripting.yml | 40 ++-------------------- .github/workflows/build-ci-image.yml | 42 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/build-ci-image.yml diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index a3e7f73980..2cc2180e25 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -26,44 +26,9 @@ concurrency: cancel-in-progress: true jobs: - build-runner-image: - permissions: - contents: read - packages: write - runs-on: ubuntu-latest - name: Build multi-platform Docker image - outputs: - image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} - steps: - - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v5 - with: - context: . - file: ./crates/xtask/Dockerfile - platforms: linux/amd64,linux/arm64 - cache-from: type=gha - cache-to: type=gha,mode=max - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - generate-job-matrix: - needs: build-runner-image runs-on: ubuntu-latest - container: ${{ needs.build-runner-image.outputs.image }} + # container: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest outputs: matrix: ${{ steps.generate-matrix.outputs.matrix }} steps: @@ -83,10 +48,9 @@ jobs: pull-requests: write name: Check - ${{ matrix.run_args.name }} runs-on: ${{ matrix.run_args.os }} - container: ${{ needs.build-runner-image.outputs.image }} + # container: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest needs: - generate-job-matrix - - build-runner-image strategy: matrix: run_args: ${{fromJson(needs.generate-job-matrix.outputs.matrix)}} diff --git a/.github/workflows/build-ci-image.yml b/.github/workflows/build-ci-image.yml new file mode 100644 index 0000000000..dc2a40dd5a --- /dev/null +++ b/.github/workflows/build-ci-image.yml @@ -0,0 +1,42 @@ +on: + workflow_dispatch: + + +env: + REGISTRY: ghcr.io + IMAGE_NAME: bevy-mod-scripting + +jobs: + build-runner-image: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + name: Build multi-platform Docker image + outputs: + image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v5 + with: + context: . + file: ./crates/xtask/Dockerfile + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}