Skip to content

Updating to pocketpy 2.0 (#232) #134

Updating to pocketpy 2.0 (#232)

Updating to pocketpy 2.0 (#232) #134

name: package-and-deploy
on:
push:
branches: [ main ]
jobs:
# WINDOWS BUILD
windows-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.27.0"
- name: run build
run: |
cd ${{ github.workspace }}
mkdir -p builds
cmake -S . -B builds -DCMAKE_BUILD_TYPE=Release -DIS_CI_BUILD="true"
cmake --build builds --config Release
- name: rename binaries
run: |
move ${{ github.workspace }}\builds\Release\crescent_engine.exe ${{ github.workspace }}\crescent_engine_windows.exe
move ${{ github.workspace }}\builds\Release\crescent_engine_editor.exe ${{ github.workspace }}\crescent_engine_editor_windows.exe
- name: run unit tests
run: |
echo "Running crescent engine tests!"
${{ github.workspace }}\builds\Release\crescent_engine_test.exe
echo ""
echo "Running crescent engine editor tests!"
${{ github.workspace }}\builds\Release\crescent_engine_editor_test.exe
- name: package dlls (and python zip)
run: |
cd ${{ github.workspace }}
mkdir -p windows_run_dependencies
# Get all dll files
$dllFiles = Get-ChildItem -Path . -Filter *.dll -Recurse
# Copy dlls
foreach ($file in $dllFiles) {
$destPath = Join-Path -Path windows_run_dependencies\ -ChildPath $file.Name
Copy-Item -Path $file.FullName -Destination $destPath
}
Compress-Archive -Path windows_run_dependencies -DestinationPath ${{ github.workspace }}\windows_run_dependencies.zip
- name: store engine binary
uses: actions/upload-artifact@v3
with:
name: crescent_engine_windows.exe
path: crescent_engine_windows.exe
if-no-files-found: error
- name: store editor binary
uses: actions/upload-artifact@v3
with:
name: crescent_engine_editor_windows.exe
path: crescent_engine_editor_windows.exe
if-no-files-found: error
- name: store windows deps
uses: actions/upload-artifact@v3
with:
name: windows_run_dependencies.zip
path: windows_run_dependencies.zip
if-no-files-found: error
# LINUX BUILD
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
sudo apt install gcc-11
sudo apt install g++-11
sudo apt install libgl1-mesa-dev libglu1-mesa-dev
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.27.0"
- name: run build
run: |
cd ${{ github.workspace }}
mkdir -p builds
cmake -S . -B builds -DCMAKE_BUILD_TYPE=Release -DIS_CI_BUILD="true"
cmake --build builds --config Release
- name: rename binaries
run: |
cd ${{ github.workspace }}
mv builds/crescent_engine crescent_engine_linux
mv builds/crescent_engine_editor crescent_engine_editor_linux
chmod +x crescent_engine_linux
chmod +x crescent_engine_editor_linux
- name: run unit tests
run: |
echo "Running crescent engine tests!"
${{ github.workspace }}/builds/crescent_engine_test
echo ""
echo "Running crescent engine editor tests!"
${{ github.workspace }}/builds/crescent_engine_editor_test
- name: store engine binary
uses: actions/upload-artifact@v3
with:
name: crescent_engine_linux
path: crescent_engine_linux
if-no-files-found: error
- name: store editor binary
uses: actions/upload-artifact@v3
with:
name: crescent_engine_editor_linux
path: crescent_engine_editor_linux
if-no-files-found: error
# MACOSX BUILD
macosx-build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
brew install pkg-config
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.27.0"
- name: run build
run: |
cd ${{ github.workspace }}
mkdir -p builds
cmake -S . -B builds -DCMAKE_BUILD_TYPE=Release -DIS_CI_BUILD="true"
cmake --build builds --config Release
- name: rename binaries
run: |
cd ${{ github.workspace }}
mv builds/crescent_engine crescent_engine_macosx
mv builds/crescent_engine_editor crescent_engine_editor_macosx
chmod +x crescent_engine_macosx
chmod +x crescent_engine_editor_macosx
- name: run unit tests
run: |
cd ${{ github.workspace }}
echo "Running crescent engine tests!"
builds/crescent_engine_test
echo ""
echo "Running crescent engine editor tests!"
builds/crescent_engine_editor_test
# - name: decode private key and cert
# run: |
# echo "${{ secrets.MAC_CERT_KEY }}" >> cert.txt
# echo "${{ secrets.MAC_PKEY }}" >> pkey.txt
# base64 -D -i cert.txt -o cert.cer
# base64 -D -i pkey.txt -o private.key
#
# - name: setup keychain
# run: |
# security create-keychain -p '${{ secrets.MAC_KEYCHAIN_PASS }}' build.keychain
# security default-keychain -s build.keychain
# security unlock-keychain -p '${{ secrets.MAC_KEYCHAIN_PASS }}' build.keychain
# security set-keychain-settings -t 3600 -u build.keychain
#
# - name: import private key
# run: |
# security import private.key -A -k build.keychain
#
# - name: import cert
# run: |
# security import cert.cer -A -k build.keychain
#
# - name: set up code signing
# run: |
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.MAC_KEYCHAIN_PASS }}" build.keychain
# security find-identity -v -p codesigning build.keychain
#
# - name: sign app
# run: |
# codesign -s "${{ secrets.MAC_SIGNING_ID }}" -v crescent_engine_macosx
# codesign -s "${{ secrets.MAC_SIGNING_ID }}" -v crescent_engine_editor_macosx
- name: store engine binary
uses: actions/upload-artifact@v3
with:
name: crescent_engine_macosx
path: crescent_engine_macosx
if-no-files-found: error
- name: store engine binary
uses: actions/upload-artifact@v3
with:
name: crescent_engine_editor_macosx
path: crescent_engine_editor_macosx
if-no-files-found: error
package-all:
runs-on: ubuntu-latest
needs: [windows-build, linux-build, macosx-build]
steps:
- uses: actions/checkout@v1
- name: set env vars
run: |
CRESCENT_VERSION=$(python3 ${{ github.workspace }}/ci/get_engine_version.py ${{ github.workspace }}/engine/src/core/core_info.h)
echo "CRESCENT_VERSION=$CRESCENT_VERSION" >> $GITHUB_ENV
- name: install pip packages
run: |
python3 -m pip install google-auth google-api-python-client
- name: setup directories
run: |
# Windows
mkdir -p crescent_windows/bin/windows
mkdir -p crescent_windows/bin/linux
mkdir -p crescent_windows/bin/macosx
# Linux
mkdir -p crescent_linux/bin/windows
mkdir -p crescent_linux/bin/linux
mkdir -p crescent_linux/bin/macosx
# Macosx
mkdir -p crescent_macosx/bin/windows
mkdir -p crescent_macosx/bin/linux
mkdir -p crescent_macosx/bin/macosx
# Create creds file
cd ${{ github.workspace }}
echo "${{ secrets.GDRIVE_CREDENTIALS }}" >> creds.json
- name: download windows engine binary
uses: actions/download-artifact@v3
with:
name: crescent_engine_windows.exe
- name: download windows editor binary
uses: actions/download-artifact@v3
with:
name: crescent_engine_editor_windows.exe
- name: download windows deps
uses: actions/download-artifact@v3
with:
name: windows_run_dependencies.zip
- name: download linux engine binary
uses: actions/download-artifact@v3
with:
name: crescent_engine_linux
- name: download linux editor binary
uses: actions/download-artifact@v3
with:
name: crescent_engine_editor_linux
- name: download macosx signed engine binary
uses: actions/download-artifact@v3
with:
name: crescent_engine_macosx
- name: download macosx signed editor binary
uses: actions/download-artifact@v3
with:
name: crescent_engine_editor_macosx
- name: build windows package
run: |
# Copy engine binaries
cp crescent_engine_windows.exe crescent_windows/bin/windows/crescent_engine.exe
cp crescent_engine_linux crescent_windows/bin/linux/crescent_engine
cp crescent_engine_macosx crescent_windows/bin/macosx/crescent_engine
cp -r assets crescent_windows/bin/windows
cp -r test_games crescent_windows/bin/windows
cp -r assets crescent_windows/bin/linux
cp -r test_games crescent_windows/bin/linux
cp -r assets crescent_windows/bin/macosx
cp -r test_games crescent_windows/bin/macosx
# Move editor
mv crescent_engine_editor_windows.exe crescent_windows/crescent.exe
# Copy windows runtime deps
# Copy windows runtime deps
unzip windows_run_dependencies.zip
cp windows_run_dependencies/* crescent_windows/
cp windows_run_dependencies/* crescent_windows/bin/windows/
chmod -R 755 crescent_windows
zip -r crescent_windows.zip crescent_windows/
- name: build linux package
run: |
# Copy engine binaries
cp crescent_engine_windows.exe crescent_linux/bin/windows/crescent_engine.exe
cp crescent_engine_linux crescent_linux/bin/linux/crescent_engine
cp crescent_engine_macosx crescent_linux/bin/macosx/crescent_engine
cp -r assets crescent_linux/bin/windows
cp -r test_games crescent_linux/bin/windows
cp -r assets crescent_linux/bin/linux
cp -r test_games crescent_linux/bin/linux
cp -r assets crescent_linux/bin/macosx
cp -r test_games crescent_linux/bin/macosx
# Move editor
mv crescent_engine_editor_linux crescent_linux/crescent
# Copy runtime deps
cp windows_run_dependencies/* crescent_linux/bin/windows/
chmod -R 755 crescent_linux
zip -r crescent_linux.zip crescent_linux/
tar -czvf crescent_linux.tar.gz crescent_linux/
- name: build macosx package
run: |
# Just build app bundle for engine as editor doesn't exist yet
# Create export template
mkdir -p crescent.app/Contents/MacOS
mkdir -p crescent.app/Contents/Resources
mkdir -p crescent.app/Contents/MacOS/bin/windows
mkdir -p crescent.app/Contents/MacOS/bin/linux
mkdir -p crescent.app/Contents/MacOS/bin/macosx
python ci/generate_macos_plist_info.py crescent.app/Contents/Info.plist crescent ${{ env.CRESCENT_VERSION }} crescent
# Copy engine binaries
cp crescent_engine_windows.exe crescent.app/Contents/MacOS/bin/windows/crescent_engine.exe
cp crescent_engine_linux crescent.app/Contents/MacOS/bin/linux/crescent_engine
cp crescent_engine_macosx crescent.app/Contents/MacOS/bin/macosx/crescent_engine
cp -r assets crescent.app/Contents/MacOS/bin/windows
cp -r test_games crescent.app/Contents/MacOS/bin/windows
cp -r assets crescent.app/Contents/MacOS/bin/linux
cp -r test_games crescent.app/Contents/MacOS/bin/linux
cp -r assets crescent.app/Contents/MacOS/bin/macosx
cp -r test_games crescent.app/Contents/MacOS/bin/macosx
# Move editor
mv crescent_engine_editor_macosx crescent.app/Contents/MacOS/crescent
# Copy runtime deps
cp windows_run_dependencies/* crescent.app/Contents/MacOS/bin/windows/
chmod -R 755 crescent.app
zip -r crescent_macosx.zip crescent.app/
tar -czvf crescent_macosx.tar.gz crescent.app/
- name: deploy packages
run: |
python -m pip install google-auth google-api-python-client
echo "${{ secrets.GDRIVE_CREDENTIALS }}" > creds.json
echo "deploying windows package"
python ci/upload_to_gd.py crescent_windows.zip ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
echo "deploying linux packages"
python ci/upload_to_gd.py crescent_linux.zip ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
python ci/upload_to_gd.py crescent_linux.tar.gz ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
echo "deploying macosx packages"
python ci/upload_to_gd.py crescent_macosx.zip ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
python ci/upload_to_gd.py crescent_macosx.tar.gz ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
- name: create or update release draft
run: |
python -m pip install PyGithub urllib3 Brotli
echo "Creating or updating release draft stub"
python ci/create_or_update_release_draft.py ${{ secrets.CI_ACCESS_TOKEN }} ${{ env.CRESCENT_VERSION }} crescent_windows.zip crescent_linux.zip crescent_linux.tar.gz crescent_macosx.zip crescent_macosx.tar.gz