Skip to content

Commit

Permalink
Clean up github workflow
Browse files Browse the repository at this point in the history
Consistently name the procest MobileCrashAnalyzer, automatically use the
filename of the source to make clear we don't rename files when creating
the deploy directory of MobileCrashAnalyzer.

Remove leftover references to MobileCrashAnalyzer artifacts in
build-desktop job.
  • Loading branch information
tmolitor-stud-tu committed Apr 24, 2024
1 parent 8c9be09 commit 864cb27
Showing 1 changed file with 37 additions and 41 deletions.
78 changes: 37 additions & 41 deletions .github/workflows/autorelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,62 @@ jobs:
# see https://data-dive.com/multi-os-deployment-in-cloud-using-pyinstaller-and-github-actions/
# but here we build first and run our createrelease job afterwards, accessing the artifacts of our build job
build-android:
name: Mobile Crash Analyzer
name: Build packages for android
runs-on: ubuntu-latest

steps:
- name: Install dependencies
run: |
sudo apt -y install apksigner
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt -y install apksigner

- name: Prepare app for buildozer
run: |
REFNAME="${{ github.ref_name }}"
echo "VERSION='${REFNAME}'" >src/shared/utils/version.py
mkdir MonalMobileCrashAnalyzer_Deploy
cp -av src/MobileCrashAnalyzer.py MonalMobileCrashAnalyzer_Deploy/MobileCrashAnalyzer.py
cp -av src/MobileCrashAnalyzer MonalMobileCrashAnalyzer_Deploy/MobileCrashAnalyzer
cp -av src/shared MonalMobileCrashAnalyzer_Deploy/shared
mkdir MobileCrashAnalyzer_Deploy
cp -av src/MobileCrashAnalyzer.py MobileCrashAnalyzer_Deploy/
cp -av src/MobileCrashAnalyzer MobileCrashAnalyzer_Deploy/
cp -av src/shared MobileCrashAnalyzer_Deploy/
cp -av src/MobileCrashAnalyzer/data/conf/intent_filters.xml MonalMobileCrashAnalyzer_Deploy/intent_filters.xml
cp -av src/MobileCrashAnalyzer/data/conf/buildozer.spec MonalMobileCrashAnalyzer_Deploy/buildozer.spec
echo "" >>MonalMobileCrashAnalyzer_Deploy/buildozer.spec
cp -av src/MobileCrashAnalyzer/data/conf/intent_filters.xml MobileCrashAnalyzer_Deploy/
cp -av src/MobileCrashAnalyzer/data/conf/buildozer.spec MobileCrashAnalyzer_Deploy/
echo "" >>MobileCrashAnalyzer_Deploy/buildozer.spec
# buildozer does not like non-numeric version numbers
echo "version = ${REFNAME#v}" >>MonalMobileCrashAnalyzer_Deploy/buildozer.spec
echo "version = ${REFNAME#v}" >>MobileCrashAnalyzer_Deploy/buildozer.spec
echo "import os" >MonalMobileCrashAnalyzer_Deploy/main.py
echo "os.environ['KIVY_LOG_MODE'] = 'MIXED'" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "os.environ['KIVY_NO_FILELOG'] = '1'" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "from importlib import util" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "real_file = os.path.join(os.path.dirname(__file__), 'MobileCrashAnalyzer.pyc')" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "print('Proxy loading real file: %s' % real_file)" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "spec = util.spec_from_file_location('MobileCrashAnalyzer', real_file)" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "print(f'{spec = }')" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "mod = util.module_from_spec(spec)" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "# we don't want to add our module to sys.modules to not interfere with the package path having the same name" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "#(just like if our real_file was the real entry point)" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "print(f'{mod = }')" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "out = spec.loader.exec_module(mod)" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "print(f'{out = }')" >>MonalMobileCrashAnalyzer_Deploy/main.py
echo "print('Proxied file returned, terminating...')" >>MonalMobileCrashAnalyzer_Deploy/main.py
# dynamically build main.py proxy to load
echo "import os" >MobileCrashAnalyzer_Deploy/main.py
echo "os.environ['KIVY_LOG_MODE'] = 'MIXED'" >>MobileCrashAnalyzer_Deploy/main.py
echo "os.environ['KIVY_NO_FILELOG'] = '1'" >>MobileCrashAnalyzer_Deploy/main.py
echo "from importlib import util" >>MobileCrashAnalyzer_Deploy/main.py
echo "real_file = os.path.join(os.path.dirname(__file__), 'MobileCrashAnalyzer.pyc')" >>MobileCrashAnalyzer_Deploy/main.py
echo "print('Proxy loading real file: %s' % real_file)" >>MobileCrashAnalyzer_Deploy/main.py
echo "" >>MobileCrashAnalyzer_Deploy/main.py
echo "spec = util.spec_from_file_location('MobileCrashAnalyzer', real_file)" >>MobileCrashAnalyzer_Deploy/main.py
echo "print(f'{spec = }')" >>MobileCrashAnalyzer_Deploy/main.py
echo "mod = util.module_from_spec(spec)" >>MobileCrashAnalyzer_Deploy/main.py
echo "# we don't want to add our module to sys.modules to not interfere with the package path having the same name" >>MobileCrashAnalyzer_Deploy/main.py
echo "#(just like if our real_file was the real entry point)" >>MobileCrashAnalyzer_Deploy/main.py
echo "print(f'{mod = }')" >>MobileCrashAnalyzer_Deploy/main.py
echo "out = spec.loader.exec_module(mod)" >>MobileCrashAnalyzer_Deploy/main.py
echo "print(f'{out = }')" >>MobileCrashAnalyzer_Deploy/main.py
echo "print('Proxied file returned, terminating...')" >>MobileCrashAnalyzer_Deploy/main.py
echo ""
echo "buildozer.spec:"
cat MonalMobileCrashAnalyzer_Deploy/buildozer.spec
cat MobileCrashAnalyzer_Deploy/buildozer.spec
echo ""
echo "main.py:"
cat MonalMobileCrashAnalyzer_Deploy/main.py
cat MobileCrashAnalyzer_Deploy/main.py
- name: Build with Buildozer
uses: Sobottasgithub/[email protected]
id: buildozer
with:
workdir: MonalMobileCrashAnalyzer_Deploy
workdir: MobileCrashAnalyzer_Deploy
buildozer_version: stable

- name: Sign Apk
Expand All @@ -87,7 +87,7 @@ jobs:
path: ${{ steps.signer.outputs.signed_apk }}

build-desktop:
name: Build packages
name: Build packages for ${{ matrix.TARGET }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
with:
python-version: 3.11
# requirements.txt was created using pipreqs
- name: Install dependencies
- name: Install common dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade pyinstaller
Expand All @@ -178,12 +178,8 @@ jobs:
run: ${{matrix.CMD_BUILD}}
- uses: actions/upload-artifact@v3
with:
name: |
${{ matrix.OUT_FILE_NAME}}
MonalMobileCrashAnalyzer
path: |
./dist/${{ matrix.OUT_FILE_NAME}} # or path/to/artifact
steps.signer.outputs.signed_apk
name: ${{ matrix.OUT_FILE_NAME}}
path: ./dist/${{ matrix.OUT_FILE_NAME}}

createrelease:
name: Create Release
Expand All @@ -207,4 +203,4 @@ jobs:
MobileCrashAnalyzer*/*
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
draft: false

0 comments on commit 864cb27

Please sign in to comment.