Skip to content

Commit

Permalink
this should bulid for linux, windows, and mac
Browse files Browse the repository at this point in the history
  • Loading branch information
maltfield committed Jun 23, 2020
1 parent faeb612 commit b7575fe
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 125 deletions.
176 changes: 88 additions & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,94 +9,94 @@ on:

jobs:

# linux:
# runs-on: ubuntu-latest
## container: debian:buster-slim
#
# steps:
#
# - uses: actions/checkout@v2
#
# - name: Execute script to build linux AppImage
# run: "build/linux/buildAppImage.sh"
# shell: bash
#
# - uses: actions/upload-artifact@v2
# with:
# name: helloWorld-linux-x86_64
# path: dist/
#
# - name: Create dist tarball
# run: 'tar -cjvf helloWorld-linux-x86_64.${{ github.run_id }}.tar.bz2 dist/*'
# shell: bash
#
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.run_id }}_linux
# release_name: 'Public Build Artifact: Linux ${{ github.run_id }}'
# draft: false
# prerelease: true
#
# - name: Upload Release Asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: helloWorld-linux-x86_64.${{ github.run_id }}.tar.bz2
# asset_name: helloWorld-linux-x86_64.${{ github.run_id }}.tar.bz2
# asset_content_type: application/x-bzip2
#
# windows:
# runs-on: windows-latest
#
# steps:
# - uses: actions/checkout@v2
#
# - name: Execute script to .exe in Windows
# run: "build/windows/buildExe.ps1"
# shell: powershell -Command "& '{0}'"
#
# - uses: actions/upload-artifact@v2
# with:
# name: Windows executable (x86_64)
# path: dist/
#
# - uses: actions/upload-artifact@v2
# with:
# name: helloWorld-windows-x86_64
# path: dist/
#
# - name: Create Release .zip
# run: 'Compress-Archive -DestinationPath helloWorld-windows-x86_64.${{ github.run_id }}.zip -Path dist\*'
# shell: powershell
#
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.run_id }}_windows
# release_name: 'Public Build Artifact: Windows ${{ github.run_id }}'
# draft: false
# prerelease: true
#
# - name: Upload Release Asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: helloWorld-windows-x86_64.${{ github.run_id }}.zip
# asset_name: helloWorld-windows-x86_64.${{ github.run_id }}.zip
# asset_content_type: application/zip
linux:
runs-on: ubuntu-latest
# container: debian:buster-slim

steps:

- uses: actions/checkout@v2

- name: Execute script to build linux AppImage
run: "build/linux/buildAppImage.sh"
shell: bash

- uses: actions/upload-artifact@v2
with:
name: helloWorld-linux-x86_64
path: dist/

- name: Create dist tarball
run: 'tar -cjvf helloWorld-linux-x86_64.${{ github.run_id }}.tar.bz2 dist/*'
shell: bash

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.run_id }}_linux
release_name: 'Public Build Artifact: Linux ${{ github.run_id }}'
draft: false
prerelease: true

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: helloWorld-linux-x86_64.${{ github.run_id }}.tar.bz2
asset_name: helloWorld-linux-x86_64.${{ github.run_id }}.tar.bz2
asset_content_type: application/x-bzip2

windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Execute script to .exe in Windows
run: "build/windows/buildExe.ps1"
shell: powershell -Command "& '{0}'"

- uses: actions/upload-artifact@v2
with:
name: Windows executable (x86_64)
path: dist/

- uses: actions/upload-artifact@v2
with:
name: helloWorld-windows-x86_64
path: dist/

- name: Create Release .zip
run: 'Compress-Archive -DestinationPath helloWorld-windows-x86_64.${{ github.run_id }}.zip -Path dist\*'
shell: powershell

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.run_id }}_windows
release_name: 'Public Build Artifact: Windows ${{ github.run_id }}'
draft: false
prerelease: true

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: helloWorld-windows-x86_64.${{ github.run_id }}.zip
asset_name: helloWorld-windows-x86_64.${{ github.run_id }}.zip
asset_content_type: application/zip

mac:
runs-on: macos-latest
Expand Down
42 changes: 5 additions & 37 deletions build/mac/buildDmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -x
#
# * https://kivy.org/doc/stable/installation/installation-osx.html
# * https://kivy.org/doc/stable/guide/packaging-osx.html
# * https://github.com/kivy/buildozer/issues/494#issuecomment-390262889
# * https://blog.fossasia.org/deploying-a-kivy-application-with-pyinstaller-for-mac-osx-to-github/
#
# Authors: Michael Altfield <[email protected]>
# Created: 2020-06-22
Expand All @@ -26,15 +26,11 @@ APP_NAME='helloWorld'
PYTHON_VERSION="`${PYTHON_PATH} --version | cut -d' ' -f2`"
PYTHON_EXEC_VERSION="`echo ${PYTHON_VERSION} | cut -d. -f1-2`"

# attempt to overwrite brew's /usr/local/bin/python3 with /usr/bin/python3
#alias python3='${PYTHON_PATH}'

########
# INFO #
########

# print some info for debugging failed builds

uname -a
sw_vers
which python2
Expand All @@ -46,18 +42,6 @@ echo $PATH
pwd
ls -lah

echo "INFO: list of python* in /usr/bin/"
ls -lah /usr/bin/python*
find /usr/bin -type f -name python | xargs --version
find /usr/bin -type f -name python3 | xargs --version
md5 /usr/bin/python*

echo "INFO: list of python* in /usr/local/bin/"
ls -lah /usr/local/bin/python*
find /usr/local/bin -type f -name python | xargs --version
find /usr/local/bin -type f -name python3 | xargs --version
md5 /usr/local/bin/python*

###################
# INSTALL DEPENDS #
###################
Expand All @@ -68,7 +52,6 @@ brew update

# install os-level depends
brew install wget python3
#brew reinstall --build-bottle sdl2 sdl2_image sdl2_ttf sdl2_mixer
brew reinstall sdl2 sdl2_image sdl2_ttf sdl2_mixer

# setup a virtualenv to isolate our app's python depends
Expand All @@ -83,14 +66,13 @@ ${PYTHON_PATH} -m pip install --upgrade --user Cython==0.29.10
${PYTHON_PATH} -m pip install --upgrade --user -r requirements.txt
${PYTHON_PATH} -m pip install --upgrade --user PyInstaller

#######################
# PREPARE PYINSTALLER #
#######################
#####################
# PYINSTALLER BUILD #
#####################

mkdir pyinstaller
pushd pyinstaller

# TODO: change this to cat
${PYTHON_PATH} -m PyInstaller -y --clean --windowed --name ${APP_NAME} \
--hidden-import 'pkg_resources.py2_warn' \
--exclude-module _tkinter \
Expand All @@ -99,12 +81,6 @@ ${PYTHON_PATH} -m PyInstaller -y --clean --windowed --name ${APP_NAME} \
--exclude-module twisted \
../src/main.py

#########
# BUILD #
#########

#pyinstaller -y --clean --windowed ${APP_NAME}.spec

pushd dist
hdiutil create ./${APP_NAME}.dmg -srcfolder ${APP_NAME}.app -ov
popd
Expand All @@ -113,13 +89,6 @@ popd
# PREPARE ARTIFACTS #
#####################

# TODO: remove this after fixing .dmg generation
# the dmg generation below fails on headless builds because you have to click
# a button in a dialog granting finder some permissions from the apple script.
# for now we include the .app
mkdir -p ../dist
cp -r "${APP_NAME}.app" ../dist/

# create the dist dir for our result to be uploaded as an artifact
mkdir -p ../dist
cp "dist/${APP_NAME}.dmg" ../dist/
Expand All @@ -135,9 +104,8 @@ python2 --version
which python3
python3 --version
${PYTHON_PATH} --version
pwd
echo $PATH
ls -lah /Users/runner/Library/Python/3.7/bin
pwd
ls -lah
ls -lah dist

Expand Down

0 comments on commit b7575fe

Please sign in to comment.