Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into experiments/moonsharp
Browse files Browse the repository at this point in the history
  • Loading branch information
andybak committed Feb 28, 2024
2 parents 64f962c + f12eaff commit 947bc28
Show file tree
Hide file tree
Showing 23 changed files with 898 additions and 120 deletions.
169 changes: 162 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ jobs:
- name: Restore Library/
id: cache_library
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 10
with:
Expand All @@ -361,7 +361,7 @@ jobs:

- name: Restore Library/PackageCache
id: cache_packagecache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 10
with:
Expand Down Expand Up @@ -499,6 +499,8 @@ jobs:
- name: Prepare for packaging (permissions and compression, OSX only)
if: matrix.targetPlatform == 'StandaloneOSX'
run: |
mv build/${{ matrix.vrsdk }}/${{ matrix.targetPlatform }}/Support "build/${{ matrix.vrsdk }}/${{ matrix.targetPlatform }}/${{ env.filename }}/Contents/"
find build -name 'UnityFbxSdkNative.bundle' -delete
# Compress, but skip the top directories
tar -c -v -z -f OpenBrush.tgz -C build/${{ matrix.vrsdk }} ${{ matrix.targetPlatform}}
rm -rf build/${{ matrix.vrsdk }}/*
Expand All @@ -525,7 +527,7 @@ jobs:
echo "diff returned: $CHANGES"
- name: Save Library/PackageCache cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: github.ref == 'refs/heads/main' && steps.check_packagecache.outputs.changes == 0 && steps.cache_packagecache.outputs.cache-hit != 'true' && ! matrix.packages_to_remove # Ideally, we'd save caches on branches, but they're too big, and branch caches can evict those from main, which is unacceptable.
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 10
Expand All @@ -552,7 +554,7 @@ jobs:
du -mcsh Library
- name: Save Library/ cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: github.ref == 'refs/heads/main' && steps.cache_library.outputs.cache-hit != 'true' # Ideally, we'd save caches on branches, but they're too big, and branch caches can evict those from main, which is unacceptable.
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 10
Expand All @@ -561,9 +563,107 @@ jobs:
# Some platforms share a cache; it's not a 1:1 mapping of either targetPlatform or vrsdk, so we have a distinct variable for which cache to use
key: Library_${{ matrix.cache }}_${{ env.UNITY_VERSION }}

createdmg:
name: Create and Notarize DMG
needs: [configuration, build]
if: |
github.event_name == 'push' &&
github.repository == 'icosa-foundation/open-brush' &&
(github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v'))
runs-on: macos-latest # the ovr-platform-util tool is only available for Mac and Windows
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true # We don't use LFS, but it adds no time, and leave it here in case we do at some point later
sparse-checkout: |
Support/macos
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: MacOS Monoscopic
path: build_macos_monoscopic

# See https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }}
INSTALL_CERTIFICATE_BASE64: ${{ secrets.APPLE_INSTALL_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.APPLE_BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
run: |
BUILD_CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
INSTALL_CERTIFICATE_PATH=$RUNNER_TEMP/install_certificate.p12
PP_PATH=$RUNNER_TEMP/openbrushmac.provisionprofile
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $BUILD_CERTIFICATE_PATH
echo -n "$INSTALL_CERTIFICATE_BASE64" | base64 --decode -o $INSTALL_CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $BUILD_CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $INSTALL_CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Sign the release
env:
VERSION: ${{ needs.configuration.outputs.version }}
run: |
tar xvfz build_macos_monoscopic/*tgz
export FILENAME=$(basename $(readlink -f StandaloneOSX/OpenBrush*.app))
cd StandaloneOSX/
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements ../Support/macos/OpenBrush.entitlements --sign "Developer ID Application: Icosa Gallery Ltd (${{ secrets.APPLE_TEAM_ID }})" $FILENAME/Contents/Support/ThirdParty/ffmpeg/bin/ffmpeg
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements ../Support/macos/OpenBrush.entitlements --sign "Developer ID Application: Icosa Gallery Ltd (${{ secrets.APPLE_TEAM_ID }})" $FILENAME
- name: Create a notarized DMG
env:
VERSION: ${{ needs.configuration.outputs.version }}
run: |
export FILENAME=$(basename $(readlink -f StandaloneOSX/OpenBrush*.app))
mkdir dist
cp Support/macos/background.png StandaloneOSX/
cp Support/macos/[email protected] StandaloneOSX/
pip install jinjanator
jinjanate Support/macos/openbrush-dmg.json.j2 > StandaloneOSX/openbrush-dmg.json
pushd StandaloneOSX/
npx appdmg openbrush-dmg.json ../dist/OpenBrush.dmg
popd
xcrun notarytool submit \
--team-id ${{ secrets.APPLE_TEAM_ID }} \
--apple-id ${{ secrets.APPLE_ID }} \
--password ${{ secrets.APPLE_APPLICATION_SPECIFIC_PASSWORD }} \
--wait \
dist/OpenBrush.dmg
xcrun stapler staple dist/OpenBrush.dmg
- name: Upload notarized dmg
uses: actions/upload-artifact@v4
with:
name: MacOS Monoscopic (DMG)
path: |
dist/OpenBrush.dmg
release:
name: Create Github Release
needs: [configuration, build]
needs: [configuration, build, createdmg]
runs-on: ubuntu-latest
if: |
github.event_name == 'push' &&
Expand Down Expand Up @@ -645,6 +745,12 @@ jobs:
name: Android Pico
path: build_android_pico

- name: Download Build Artifacts (Mac)
uses: actions/download-artifact@v4
with:
name: MacOS Monoscopic (DMG)
path: build_monoscopic_macos

- name: Package Artifacts for release
env:
VERSION: ${{ needs.configuration.outputs.version }}
Expand All @@ -656,6 +762,7 @@ jobs:
mv build_windows_openxr/StandaloneWindows64/ releases/OpenBrush_Desktop_$VERSION/
mv build_windows_rift/StandaloneWindows64/ releases/OpenBrush_Rift_$VERSION/
mv build_windows_mono/StandaloneWindows64/ releases/OpenBrush_Mono_$VERSION/
mv build_monoscopic_macos/*.dmg releases/OpenBrush_Mac_Mono_$VERSION.dmg
cd releases
zip -r OpenBrush_Desktop_$VERSION.zip OpenBrush_Desktop_$VERSION/
zip -r OpenBrush_Rift_$VERSION.zip OpenBrush_Rift_$VERSION/
Expand Down Expand Up @@ -740,7 +847,7 @@ jobs:

publish_steam:
name: Publish Steam Release
needs: [configuration, build]
needs: [configuration, build, createdmg]
if: |
github.event_name == 'push' &&
github.repository == 'icosa-foundation/open-brush' &&
Expand All @@ -755,7 +862,7 @@ jobs:
Support/steam
lfs: true # We don't use LFS, but it adds no time, and leave it here in case we do at some point later
- name: Setup steamcmd
uses: CyberAndrii/setup-steamcmd@v1.1.5
uses: CyberAndrii/setup-steamcmd@v1.2.0
- name: Restore steam login config
run: |
mkdir -p /home/runner/Steam/config
Expand Down Expand Up @@ -1066,3 +1173,51 @@ jobs:
# For Pico, Beta channels can only get one build, not a separate China / non-China build
./pico-cli upload-build --app-id $PICO_APP_ID --app-secret $PICO_APP_SECRET --region noncn --apk OpenBrush_Pico_$VERSION.apk --channel 3 --notes-en "Version $VERSION" --device 'PICO Neo3,PICO Neo3 Pro,PICO Neo3 Eye,PICO 4'
fi
publish_ios_appstore:
name: Release to iOS App Store
needs: [configuration, build]
runs-on: macos-latest
if: |
github.event_name == 'push' &&
github.repository == 'icosa-foundation/open-brush' &&
(github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v'))
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: |
Gemfile
Gemfile.lock
fastlane
- name: Download iOS Artifact
uses: actions/download-artifact@v4
with:
name: iOS Zapbox
path: build/iOS

- name: Fix File Permissions and Run fastlane
env:
APPLE_CONNECT_EMAIL: ${{ secrets.APPLE_CONNECT_EMAIL }}
APPLE_DEVELOPER_EMAIL: ${{ secrets.APPLE_DEVELOPER_EMAIL }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }}
MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}

APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
APPSTORE_P8: ${{ secrets.APPSTORE_P8 }}

IOS_BUILD_PATH: ${{ format('{0}/build/iOS', github.workspace) }}
IOS_BUNDLE_ID: foundation.icosa.openbrushzapbox
PROJECT_NAME: Open Brush for Zapbox
run: |
eval "$(ssh-agent -s)"
ssh-add - <<< "${MATCH_DEPLOY_KEY}"
find $IOS_BUILD_PATH -type f -name "**.sh" -exec chmod +x {} \;
bundle install
bundle exec fastlane ios release
37 changes: 37 additions & 0 deletions .github/workflows/generate_certs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Generate iOS Certs

on:
workflow_run:
workflows: ['iOS One-Time Setup']
types:
- completed
workflow_dispatch:

jobs:
generate_certs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true

- name: Build iOS
shell: bash
run: |
eval "$(ssh-agent -s)"
ssh-add - <<< "${MATCH_DEPLOY_KEY}"
bundle exec fastlane ios sync_certificates
env:
APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
APPSTORE_P8: ${{ secrets.APPSTORE_P8 }}

IOS_BUNDLE_ID: ${{ secrets.IOS_BUNDLE_ID }}

GH_PAT: ${{ secrets.GH_PAT }}
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }}
MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
26 changes: 26 additions & 0 deletions .github/workflows/ios_setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: iOS One-Time Setup

on: workflow_dispatch

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true

- name: Build iOS
shell: bash
run: |
bundle exec fastlane ios init_ci
env:
APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
APPSTORE_P8: ${{ secrets.APPSTORE_P8 }}

GH_PAT: ${{ secrets.GH_PAT }}
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }}
29 changes: 4 additions & 25 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
dotnet-version: '7.0.x'
- name: Cache pre-commit directories # This is also built into the action, but we want to create our own cache (which they can load) because of the hack below. If we remove it, we can remove this cache as well
uses: actions/cache@v3
python-version: '3.12'
- uses: actions/[email protected]
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: "HACK: manually install dotnet-format into pre-commit's cache"
run: |
pip install pre-commit
set +e
echo "Ignore the error below:"
pre-commit run dotnet-format # This will fail, so ignore it, but we need it to create the "random" directory for the dotnet-format
echo "Don't ignore any error that come after this point"
set -e
PRE_COMMIT_PATHS="$(echo 'SELECT path FROM repos WHERE repo == "https://github.com/dotnet/format";' | sqlite3 ~/.cache/pre-commit/db.db)"
for path in $PRE_COMMIT_PATHS
do
PRE_COMMIT_PATH="${path}/dotnetenv-default/bin"
if [ ! -f ${PRE_COMMIT_PATH}/dotnet-format ]
then
dotnet tool install dotnet-format --version "7.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --tool-path $PRE_COMMIT_PATH
fi
echo '{"additional_dependencies": []}' > $PRE_COMMIT_PATH/../.install_state_v1
done
- uses: pre-commit/[email protected]
dotnet-version: '8.0.x'
- uses: pre-commit/[email protected]
17 changes: 10 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
repos:
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
rev: v1.34.0
hooks:
- id: yamllint
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.2.0
hooks:
- id: black
files: ^Support/
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
files: ^Support/
- repo: https://github.com/PyCQA/pylint.git
rev: v3.0.1
rev: v3.0.3
hooks:
- id: pylint
name: pylint
Expand All @@ -27,12 +27,15 @@ repos:
args:
- --load-plugins=pylint.extensions.redefined_variable_type,pylint.extensions.bad_builtin
- --disable=import-error
- repo: https://github.com/dotnet/format
rev: "a2c1431dabf2229052cf598f86f31bc3eac5bc7b" # Main as of 2022-12-05
- repo: local
hooks:
# Use dotnet format already installed on your machine
- id: dotnet-format
exclude: ^(Assets/ThirdParty)|(Packages/)|(Assets/Photon/)
name: dotnet-format
language: system
entry: dotnet format whitespace
types_or: ["c#", "vb"]
exclude: ^(Assets/ThirdParty)|(Packages/)|(Assets/Photon/)
args:
- --folder
- --include
Loading

0 comments on commit 947bc28

Please sign in to comment.