Skip to content

Commit

Permalink
add stuff from bevy game template
Browse files Browse the repository at this point in the history
  • Loading branch information
sim82 committed Nov 15, 2023
1 parent fb13fe0 commit 0f72263
Show file tree
Hide file tree
Showing 31 changed files with 941 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI

on:
pull_request:
push:

jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
if: runner.os == 'linux'
- name: Build & run tests
run: cargo test
all-doc-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-all-doc-tests-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run doc tests with all features (this also compiles README examples)
run: cargo test --doc --all-features
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-lint-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features
- name: Check format
run: cargo fmt --all -- --check
40 changes: 40 additions & 0 deletions .github/workflows/deploy-page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: deploy-github-page

on:
workflow_dispatch:

permissions:
contents: write

jobs:
build-web:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install Dependencies
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Install trunk
uses: jetli/trunk-action@v0.1.0
with:
version: 'latest'
- name: Add wasm target
run: |
rustup target add wasm32-unknown-unknown
- name: Build Release
run: |
trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
- name: optimize Wasm
uses: NiklasEi/wasm-opt-action@v2
with:
file: dist/*.wasm
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: dist
74 changes: 74 additions & 0 deletions .github/workflows/release-android-google-play.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: release-android-google-play

on:
workflow_dispatch:
inputs:
version:
description: 'GitHub Release'
required: true
type: string
play_release:
description: 'Release name from google play console'
required: true
type: string

# ToDo: adapt names
env:
# used for uploading the app to a GitHub release
GAME_EXECUTABLE_NAME: bevy_game
BUNDLE_PATH: "target/x/release/android/mobile.aab"
PACKAGE_NAME: "me.nikl.bevygame"
# release track; you can promote a build to "higher" tracks in the play console or publish to a different track directly
# see track at https://github.com/r0adkll/upload-google-play#inputs for more options
TRACK: internal
MOBILE_DIRECTORY: mobile

permissions:
contents: write

jobs:
bundle-sign-release:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Install Dependencies
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev lld llvm
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Add Android targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi
- name: Install cargo-binstall
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install xbuild
run: cargo binstall --git https://github.com/NiklasEi/xbuild --bin-dir x xbuild -y
- name: Build app bundle
run: |
cd ${{ env.MOBILE_DIRECTORY }}
x doctor
x build --release --platform android --store play
- name: sign app bundle
run: |
KEYSTORE_PATH=${{ runner.temp }}/upload-keystore.jks
echo -n "${{ secrets.PLAYSTORE_KEYSTORE }}" | base64 --decode > $KEYSTORE_PATH
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore $KEYSTORE_PATH -storepass "${{ secrets.PLAYSTORE_KEYSTORE_PASSWORD }}" ${{ env.BUNDLE_PATH }} upload
- name: Upload self-signed bundle to GitHub
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.BUNDLE_PATH }}
asset_name: ${{ env.GAME_EXECUTABLE_NAME }}_${{ inputs.version }}_android.aab
release_name: ${{ inputs.version }}
tag: ${{ inputs.version }}
overwrite: true
- name: prepare Google play store secrets
run: |
SERVICE_ACCOUNT=${{ runner.temp }}/service-account.json
echo -n "${{ secrets.PLAYSTORE_SERVICE_ACCOUNT }}" | base64 --decode > $SERVICE_ACCOUNT
- name: upload bundle to Google play store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: ${{ runner.temp }}/service-account.json
packageName: ${{ env.PACKAGE_NAME }}
releaseName: ${{ inputs.play_release }}
releaseFiles: ${{ env.BUNDLE_PATH }}
track: ${{ env.TRACK }}
96 changes: 96 additions & 0 deletions .github/workflows/release-ios-testflight.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: release-ios-testflight

# This workflow builds, archives, exports, validates and uploads your ios app.
# The version from input is only used for artifact names and as the release to upload the final ipa to.
# Bump the versions in `mobile/ios-src/Info.plist` to change the version of your app bundle.

# Special setup and Apple Developer Program membership (99$/year) is required for this workflow! (docs are in work; Todo)

on:
workflow_dispatch:
inputs:
version:
description: 'Version - in the form of v1.2.3'
required: true
type: string

# ToDo: adapt names
env:
# used for uploading the app to a GitHub release
GAME_EXECUTABLE_NAME: bevy_game
XCODE_PROJECT: mobile
MOBILE_DIRECTORY: mobile

permissions:
contents: write

jobs:
build-for-iOS:
runs-on: macos-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Add iOS targets
run: rustup target add aarch64-apple-ios
- name: Install the Apple certificate and provisioning profile
id: profile
env:
IOS_CERTIFICATE: ${{ secrets.IOS_CERTIFICATE }}
IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
IOS_PROVISION_PROFILE: ${{ secrets.IOS_PROVISION_PROFILE }}
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=${{ runner.temp }}/build_certificate.p12
PP_PATH=${{ runner.temp }}/profile.mobileprovision
KEYCHAIN_PATH=${{ runner.temp }}/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$IOS_CERTIFICATE" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$IOS_PROVISION_PROFILE" | base64 --decode -o $PP_PATH
uuid=`grep UUID -A1 -a $PP_PATH | grep -io "[-A-F0-9]\{36\}"`
echo "uuid=$uuid" >> $GITHUB_OUTPUT
# create temporary keychain
security create-keychain -p "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$IOS_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/$uuid.mobileprovision
- name: Build app for iOS
run: |
cd ${{ env.MOBILE_DIRECTORY }}
xcodebuild PROVISIONING_PROFILE=${{ steps.profile.outputs.uuid }} -scheme ${{ env.XCODE_PROJECT }} clean archive -archivePath "Actions" -configuration Release -arch arm64
- name: export ipa
env:
EXPORT_PLIST: ${{ secrets.IOS_EXPORT_PRODUCTION }}
run: |
EXPORT_PLIST_PATH=${{ runner.temp }}/ExportOptions.plist
echo -n "$EXPORT_PLIST" | base64 --decode --output $EXPORT_PLIST_PATH
xcodebuild PROVISIONING_PROFILE=${{ steps.profile.outputs.uuid }} -exportArchive -archivePath ${{ env.MOBILE_DIRECTORY }}/Actions.xcarchive -exportOptionsPlist $EXPORT_PLIST_PATH -exportPath ${{ runner.temp }}/export
- name: decode API key
env:
API_KEY_BASE64: ${{ secrets.IOS_APPSTORE_API_PRIVATE_KEY }}
run: |
mkdir -p ~/private_keys
echo -n "$API_KEY_BASE64" | base64 --decode --output ~/private_keys/AuthKey_${{ secrets.IOS_APPSTORE_API_KEY_ID }}.p8
- name: Upload to testflight
run: |
xcrun altool --validate-app -f ${{ runner.temp }}/export/${{ env.XCODE_PROJECT }}.ipa -t ios --apiKey ${{ secrets.IOS_APPSTORE_API_KEY_ID }} --apiIssuer ${{ secrets.IOS_APPSTORE_ISSUER_ID }}
xcrun altool --upload-app -f ${{ runner.temp }}/export/${{ env.XCODE_PROJECT }}.ipa -t ios --apiKey ${{ secrets.IOS_APPSTORE_API_KEY_ID }} --apiIssuer ${{ secrets.IOS_APPSTORE_ISSUER_ID }}
- name: Upload release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.temp }}/export/${{ env.XCODE_PROJECT }}.ipa
asset_name: ${{ env.GAME_EXECUTABLE_NAME }}_${{ inputs.version }}_ios.ipa
release_name: ${{ inputs.version }}
tag: ${{ inputs.version }}
overwrite: true
Loading

0 comments on commit 0f72263

Please sign in to comment.