Initial commit
This commit is contained in:
commit
0527e0ccaa
|
|
@ -0,0 +1,78 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
# Run cargo test
|
||||
test:
|
||||
name: Test Suite
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }}
|
||||
- name: Install stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Run cargo test
|
||||
run: cargo test
|
||||
|
||||
# Run cargo clippy -- -D warnings
|
||||
clippy_check:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }}
|
||||
- name: Install stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||
- name: Run clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
# Run cargo fmt --all -- --check
|
||||
format:
|
||||
name: Format
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Install stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt
|
||||
- name: Run cargo fmt
|
||||
run: cargo fmt --all -- --check
|
||||
|
|
@ -0,0 +1,304 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# update with the name of the main binary
|
||||
binary: bevy_github_ci_template
|
||||
add_binaries_to_github_release: true
|
||||
#itch_target: <itch.io-username>/<game-name>
|
||||
|
||||
# Before enabling LFS, please take a look at GitHub's documentation for costs and quota limits:
|
||||
# https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage
|
||||
use_git_lfs: false
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
# Build for wasm
|
||||
release-wasm:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: olegtarasov/get-tag@v2.1.2
|
||||
id: get_version
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: ${{ env.use_git_lfs }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: wasm32-unknown-unknown
|
||||
- name: install wasm-bindgen-cli
|
||||
run: |
|
||||
cargo install wasm-bindgen-cli
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cargo build --release --target wasm32-unknown-unknown
|
||||
|
||||
- name: Prepare package
|
||||
run: |
|
||||
wasm-bindgen --no-typescript --out-name bevy_game --out-dir wasm --target web target/wasm32-unknown-unknown/release/${{ env.binary }}.wasm
|
||||
cp -r assets wasm/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
|
||||
|
||||
- name: Package as a zip
|
||||
working-directory: ./wasm
|
||||
run: |
|
||||
zip --recurse-paths ../${{ env.binary }}.zip .
|
||||
|
||||
- name: Upload binaries to artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: ${{ env.binary }}.zip
|
||||
name: wasm
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload binaries to release
|
||||
if: ${{ env.add_binaries_to_github_release == 'true' }}
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.binary }}.zip
|
||||
asset_name: ${{ env.binary }}-wasm-${{ steps.get_version.outputs.tag }}.zip
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
# Build for Linux
|
||||
release-linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: olegtarasov/get-tag@v2.1.2
|
||||
id: get_version
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: ${{ env.use_git_lfs }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
- name: install dependencies
|
||||
run: |
|
||||
sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cargo build --release --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Prepare package
|
||||
run: |
|
||||
mkdir linux
|
||||
cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/
|
||||
cp -r assets linux/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
|
||||
|
||||
- name: Package as a zip
|
||||
working-directory: ./linux
|
||||
run: |
|
||||
zip --recurse-paths ../${{ env.binary }}.zip .
|
||||
|
||||
- name: Upload binaries to artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: ${{ env.binary }}.zip
|
||||
name: linux
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload binaries to release
|
||||
if: ${{ env.add_binaries_to_github_release == 'true' }}
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.binary }}.zip
|
||||
asset_name: ${{ env.binary }}-linux-${{ steps.get_version.outputs.tag }}.zip
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
# Build for Windows
|
||||
release-windows:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: olegtarasov/get-tag@v2.1.2
|
||||
id: get_version
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: ${{ env.use_git_lfs }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cargo build --release --target x86_64-pc-windows-msvc
|
||||
|
||||
- name: Prepare package
|
||||
run: |
|
||||
mkdir windows
|
||||
cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/
|
||||
mkdir assets -ea 0 # create the assets directory if it does not exist, it will get ignored in the zip if empty
|
||||
cp -r assets windows/
|
||||
|
||||
- name: Package as a zip
|
||||
run: |
|
||||
Compress-Archive -Path windows/* -DestinationPath ${{ env.binary }}.zip
|
||||
|
||||
- name: Upload binaries to artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: ${{ env.binary }}.zip
|
||||
name: windows
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload binaries to release
|
||||
if: ${{ env.add_binaries_to_github_release == 'true' }}
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.binary }}.zip
|
||||
asset_name: ${{ env.binary }}-windows-${{ steps.get_version.outputs.tag }}.zip
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
# Build for MacOS x86_64
|
||||
release-macOS-intel:
|
||||
runs-on: macOS-latest
|
||||
|
||||
steps:
|
||||
- uses: olegtarasov/get-tag@v2.1.2
|
||||
id: get_version
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: ${{ env.use_git_lfs }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-apple-darwin
|
||||
- name: Environment Setup
|
||||
run: |
|
||||
export CFLAGS="-fno-stack-check"
|
||||
export MACOSX_DEPLOYMENT_TARGET="10.9"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cargo build --release --target x86_64-apple-darwin
|
||||
|
||||
- name: Prepare Package
|
||||
run: |
|
||||
mkdir -p ${{ env.binary }}.app/Contents/MacOS
|
||||
cp target/x86_64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/
|
||||
cp -r assets ${{ env.binary }}.app/Contents/MacOS/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
|
||||
hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-intel.dmg
|
||||
|
||||
- name: Upload binaries to artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: ${{ env.binary }}-macOS-intel.dmg
|
||||
name: macOS-intel
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload binaries to release
|
||||
if: ${{ env.add_binaries_to_github_release == 'true' }}
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.binary }}-macOS-intel.dmg
|
||||
asset_name: ${{ env.binary }}-macOS-intel-${{ steps.get_version.outputs.tag }}.dmg
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
# Build for MacOS Apple Silicon
|
||||
release-macOS-apple-silicon:
|
||||
runs-on: macOS-latest
|
||||
|
||||
steps:
|
||||
- uses: olegtarasov/get-tag@v2.1.2
|
||||
id: get_version
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: ${{ env.use_git_lfs }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-darwin
|
||||
- name: Environment
|
||||
# macOS 11 was the first version to support ARM
|
||||
run: |
|
||||
export MACOSX_DEPLOYMENT_TARGET="11"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cargo build --release --target aarch64-apple-darwin
|
||||
|
||||
- name: Prepare Package
|
||||
run: |
|
||||
mkdir -p ${{ env.binary }}.app/Contents/MacOS
|
||||
cp target/aarch64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/
|
||||
cp -r assets ${{ env.binary }}.app/Contents/MacOS/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
|
||||
hdiutil create -fs HFS+ -volname "${{ env.binary }}-macOS-apple-silicon" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-apple-silicon.dmg
|
||||
|
||||
- name: Upload binaries to artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: ${{ env.binary }}-macOS-apple-silicon.dmg
|
||||
name: macOS-apple-silicon
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload binaries to release
|
||||
if: ${{ env.add_binaries_to_github_release == 'true' }}
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.binary }}-macOS-apple-silicon.dmg
|
||||
asset_name: ${{ env.binary }}-macOS-apple-silicon-${{ steps.get_version.outputs.tag }}.dmg
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
check-if-upload-to-itch-is-configured:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should-upload: ${{ steps.check-env.outputs.has-itch-target }}
|
||||
steps:
|
||||
- id: check-env
|
||||
run: |
|
||||
if [[ -z "$itch_target" ]]; then
|
||||
echo "has-itch-target=no" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has-itch-target=yes" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
upload-to-itch:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- check-if-upload-to-itch-is-configured
|
||||
- release-wasm
|
||||
- release-linux
|
||||
- release-windows
|
||||
- release-macOS-intel
|
||||
- release-macOS-apple-silicon
|
||||
if: ${{ needs.check-if-upload-to-itch-is-configured.outputs.should-upload == 'yes' }}
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ./builds
|
||||
|
||||
- name: Install butler
|
||||
run: |
|
||||
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
|
||||
unzip butler.zip
|
||||
chmod +x butler
|
||||
./butler -V
|
||||
- uses: olegtarasov/get-tag@v2.1.2
|
||||
id: get_version
|
||||
- name: Upload to itch.io
|
||||
env:
|
||||
BUTLER_API_KEY: ${{ secrets.BUTLER_CREDENTIALS }}
|
||||
run: |
|
||||
for channel in $(ls builds); do
|
||||
./butler push \
|
||||
--fix-permissions \
|
||||
--userversion="${{ steps.get_version.outputs.tag }}" \
|
||||
builds/$channel/* \
|
||||
${{ env.itch_target }}:$channel
|
||||
done
|
||||
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
[package]
|
||||
name = "bevy_github_ci_template"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0 OR CC0-1.0"
|
||||
|
||||
# Compile with Performance Optimizations:
|
||||
# https://bevyengine.org/learn/book/getting-started/setup/#compile-with-performance-optimizations
|
||||
|
||||
# Enable a small amount of optimization in debug mode
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
||||
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 3
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.11"
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
# Bevy GitHub CI Template
|
||||
|
||||
This repo show how to set up CI on a GitHub project for Bevy.
|
||||
|
||||
It creates two workflows:
|
||||
|
||||
* [CI](#CI)
|
||||
* [Release](#Release)
|
||||
|
||||
## CI
|
||||
|
||||
Definition: [.github/workflows/ci.yaml](./.github/workflows/ci.yaml)
|
||||
|
||||
This workflow runs on every commit to `main` branch, and on every PR targeting the `main` branch.
|
||||
|
||||
It will use rust stable on linux, with cache between different executions, those commands:
|
||||
|
||||
* `cargo test`
|
||||
* `cargo clippy -- -D warnings`
|
||||
* `cargo fmt --all -- --check`
|
||||
|
||||
If you are using anything OS specific or rust nightly, you should update the file [ci.yaml](./.github/workflows/ci.yaml) to use those.
|
||||
|
||||
## Release
|
||||
|
||||
Definition: [.github/workflows/release.yaml](./.github/workflows/release.yaml)
|
||||
|
||||
This workflow runs on every tag.
|
||||
|
||||
It will build:
|
||||
* For Linux and Windows, a .zip archive containing the executable and the `assets`.
|
||||
* For macOS, a dmg image with a .app containing the `assets`.
|
||||
* For wasm, a .zip archive with the wasm binary, the js bindings, an html file loading it, and the `assets`.
|
||||
|
||||
If you don't want to target some of those platforms, you can remove the corresponding job from the file [release.yaml](./.github/workflows/release.yaml).
|
||||
|
||||
If you don't want to attach the builds to the GitHub release, set `env.add_binaries_to_github_release` to `false`.
|
||||
|
||||
If you are using Git LFS, set `env.use_git_lfs` to `true` so your assets are properly checked out.
|
||||
|
||||
> [!Warning]
|
||||
> GitHub's LFS storage has a quota. Please take a look at GitHub's documentation [here](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage) to understand the quota and costs before enabling this option.
|
||||
|
||||
### Git Tag from GitHub UI
|
||||
|
||||
You can follow [Managing releases in a repository](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository)
|
||||
|
||||
### Git Tag from the CLI
|
||||
|
||||
Execute the following commands:
|
||||
|
||||
```sh
|
||||
git tag -a "my-game-1.0" -m "First official release"
|
||||
git push --tags
|
||||
```
|
||||
|
||||
### Result
|
||||
|
||||
A new release will be available in GitHub, with the archives per platform available as downloadable assets.
|
||||
|
||||
The `git` commands above produced this release: [my-game-1.0](
|
||||
https://github.com/bevyengine/bevy_github_ci_template/releases/tag/my-game-1.0).
|
||||
|
||||
## Using the workflows in your own project
|
||||
|
||||
If you would like to use the GitHub workflows included here for your own project, there are a few things you might have to adapt:
|
||||
|
||||
1. The release workflow relies on the `index.html` file under `/wasm` for web builds
|
||||
2. Make sure that the env variable `binary` ([release.yaml](.github/workflows/release.yaml#L10)) matches the name of your binary
|
||||
3. Adapt the used toolchain if you are using nightly
|
||||
4. In your GitHub repo's settings, under `Actions -> General` make sure "Read and Write permissions" is selected under "Workflow permissions" near the bottom. This fixes the error `Error: Resource not accessible by integration`.
|
||||
|
||||
|
||||
### Publish on itch.io
|
||||
|
||||
The release flow can be configured to push the releases to itch.io:
|
||||
|
||||
1. Create an API key in https://itch.io/user/settings/api-keys
|
||||
2. Go to the repository's Settings tab in GitHub, click on Secrets->Actions in the sidebar,and add a repository secret named `BUTLER_CREDENTIALS` set to the API key.
|
||||
3. Uncomment `env.itch_target` in `release.yaml` and set it to the itch.io username and the name of the game on itch.io, separated by a slash (`/`)
|
||||
|
||||
Once that is done, any tag pushed to GitHub will trigger an itch.io release and use the tag as the [user version](https://itch.io/docs/butler/pushing.html#specifying-your-own-version-number).
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of
|
||||
|
||||
* Apache License, Version 2.0
|
||||
([LICENSE-APACHE-2.0](LICENSE-Apache-2.0) or <http://www.apache.org/licenses/LICENSE-2.0>)
|
||||
* MIT License
|
||||
([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
||||
* CC0-1.0 License
|
||||
([LICENSE-CC0-1.0](LICENSE-CC0-1.0) or <https://creativecommons.org/publicdomain/zero/1.0/legalcode>)
|
||||
|
||||
at your option.
|
||||
|
||||
The Ducky sprite is CC-0 licensed by [Caz Creates Games](https://caz-creates-games.itch.io/ducky-2).
|
||||
|
||||
## Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
|
||||
triple licensed as above, without any additional terms or conditions.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
|
|
@ -0,0 +1,22 @@
|
|||
// Bevy code commonly triggers these lints and they may be important signals
|
||||
// about code quality. They are sometimes hard to avoid though, and the CI
|
||||
// workflow treats them as errors, so this allows them throughout the project.
|
||||
// Feel free to delete this line.
|
||||
#![allow(clippy::too_many_arguments, clippy::type_complexity)]
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_systems(Startup, setup)
|
||||
.run();
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
commands.spawn(Camera2dBundle::default());
|
||||
commands.spawn(SpriteBundle {
|
||||
texture: asset_server.load("ducky.png"),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<body style="margin: 0px;">
|
||||
<script type="module">
|
||||
import './restart-audio-context.js'
|
||||
import init from './bevy_game.js'
|
||||
|
||||
init().catch((error) => {
|
||||
if (!error.message.startsWith("Using exceptions for control flow, don't mind me. This isn't actually an error!")) {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// taken from https://developer.chrome.com/blog/web-audio-autoplay/#moving-forward
|
||||
(function () {
|
||||
// An array of all contexts to resume on the page
|
||||
const audioContextList = [];
|
||||
|
||||
// An array of various user interaction events we should listen for
|
||||
const userInputEventNames = [
|
||||
'click',
|
||||
'contextmenu',
|
||||
'auxclick',
|
||||
'dblclick',
|
||||
'mousedown',
|
||||
'mouseup',
|
||||
'pointerup',
|
||||
'touchend',
|
||||
'keydown',
|
||||
'keyup',
|
||||
];
|
||||
|
||||
// A proxy object to intercept AudioContexts and
|
||||
// add them to the array for tracking and resuming later
|
||||
self.AudioContext = new Proxy(self.AudioContext, {
|
||||
construct(target, args) {
|
||||
const result = new target(...args);
|
||||
audioContextList.push(result);
|
||||
return result;
|
||||
},
|
||||
});
|
||||
|
||||
// To resume all AudioContexts being tracked
|
||||
function resumeAllContexts(event) {
|
||||
let count = 0;
|
||||
|
||||
audioContextList.forEach(context => {
|
||||
if (context.state !== 'running') {
|
||||
context.resume();
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
|
||||
// If all the AudioContexts have now resumed then we
|
||||
// unbind all the event listeners from the page to prevent
|
||||
// unnecessary resume attempts
|
||||
if (count == audioContextList.length) {
|
||||
userInputEventNames.forEach(eventName => {
|
||||
document.removeEventListener(eventName, resumeAllContexts);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// We bind the resume function for each user interaction
|
||||
// event on the page
|
||||
userInputEventNames.forEach(eventName => {
|
||||
document.addEventListener(eventName, resumeAllContexts);
|
||||
});
|
||||
})();
|
||||
Loading…
Reference in New Issue