Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GitHub Actions Workflow for Building and Releasing Application #99

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/build-release.yml
@@ -0,0 +1,61 @@
name: Build Release
on:
push:
branches: "!*"
tags: "v*"

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: rubem-ci
environment-file: env-ci.yml
python-version: 3.9
auto-activate-base: false

- name: Create Version File
run: |
Write-Output(("${{ github.ref_name }}" -replace 'v(.*)-.*', '$1') + '.0') > version.txt
create-version-file metadata.yml --outfile versionfile.txt

- name: Create Package
run: pyinstaller rubem.spec --noconfirm

- name: Test Package
run: |
./dist/rubem/rubem -h

- name: Zip files
run: |
Set-Location -Path .\dist\rubem
7z a -tzip -mx=9 -r "..\rubem-${{ github.ref_name }}-win-x86_64.zip" .\*

- name: Test Zip
run: |
7z t "dist/rubem-${{ github.ref_name }}-win-x86_64.zip"

- name: Compute Hash
run: |
$hash = Get-FileHash -Path dist/rubem-${{ github.ref_name }}-win-x86_64.zip -Algorithm SHA512
echo $hash.Hash $([System.IO.Path]::GetFileName($hash.Path)) > dist/rubem-${{ github.ref_name }}-win-x86_64.zip.sha512

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
files: |
./dist/rubem-${{ github.ref_name }}-win-x86_64.zip
./dist/rubem-${{ github.ref_name }}-win-x86_64.zip.sha512
draft: false
prerelease: false
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -39,7 +39,6 @@ MANIFEST
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
Expand Down Expand Up @@ -147,3 +146,7 @@ dmypy.json

# Cython debug symbols
cython_debug/

# pyinstaller_versionfile
version.txt
versionfile.txt
116 changes: 116 additions & 0 deletions env-ci.yml
@@ -0,0 +1,116 @@
name: rubem-ci
channels:
- conda-forge
- defaults
dependencies:
- blosc=1.21.4=hdccc3a2_0
- boost-cpp=1.78.0=h9f4b32c_3
- bzip2=1.0.8=h8ffe710_4
- ca-certificates=2023.5.7=h56e8100_0
- cairo=1.16.0=hdecc03f_1015
- cfitsio=4.2.0=h9ebe7e4_0
- curl=8.0.1=h68f0423_0
- expat=2.5.0=h63175ca_1
- font-ttf-dejavu-sans-mono=2.37=hab24e00_0
- font-ttf-inconsolata=3.000=h77eed37_0
- font-ttf-source-code-pro=2.038=h77eed37_0
- font-ttf-ubuntu=0.83=hab24e00_0
- fontconfig=2.14.2=hbde0cde_0
- fonts-conda-ecosystem=1=0
- fonts-conda-forge=1=0
- freetype=2.12.1=h546665d_1
- freexl=1.0.6=h67ca5e6_1
- gdal=3.6.4=py39h759b988_2
- geos=3.11.2=h1537add_0
- geotiff=1.7.1=h7222e44_8
- gettext=0.21.1=h5728263_0
- glib=2.76.2=h12be248_0
- glib-tools=2.76.2=h12be248_0
- gst-plugins-base=1.22.0=h001b923_2
- gstreamer=1.22.0=h6b5321d_2
- hdf4=4.2.15=h1334946_6
- hdf5=1.14.0=nompi_h918d9b7_103
- icu=72.1=h63175ca_0
- intel-openmp=2023.1.0=h57928b3_46319
- kealib=1.5.1=h2e80506_0
- krb5=1.20.1=heb0366b_0
- lcms2=2.15=h3e3b177_1
- lerc=4.0.0=h63175ca_0
- libaec=1.0.6=h63175ca_1
- libblas=3.9.0=16_win64_mkl
- libcblas=3.9.0=16_win64_mkl
- libclang=16.0.3=default_h8b4101f_0
- libclang13=16.0.3=default_h45d3cf4_0
- libcurl=8.0.1=h68f0423_0
- libdeflate=1.18=hcfcfb64_0
- libexpat=2.5.0=h63175ca_1
- libffi=3.4.2=h8ffe710_5
- libgdal=3.6.4=h36c8192_2
- libglib=2.76.2=he8f3873_0
- libhwloc=2.9.1=h51c2c0f_0
- libiconv=1.17=h8ffe710_0
- libjpeg-turbo=2.1.5.1=hcfcfb64_0
- libkml=1.3.0=hf2ab4e4_1015
- liblapack=3.9.0=16_win64_mkl
- libnetcdf=4.9.2=nompi_hc664c2b_104
- libogg=1.3.4=h8ffe710_1
- libpng=1.6.39=h19919ed_0
- libpq=15.3=ha9684e8_0
- librttopo=1.1.0=he1da8c1_13
- libspatialite=5.0.1=h50a8ebb_25
- libsqlite=3.41.2=hcfcfb64_1
- libssh2=1.10.0=h9a1e1f7_3
- libtiff=4.5.0=h6c8260b_6
- libvorbis=1.3.7=h0e60522_0
- libwebp-base=1.3.0=hcfcfb64_0
- libxml2=2.10.4=hc3477c8_0
- libzip=1.9.2=h519de47_1
- libzlib=1.2.13=hcfcfb64_4
- lz4-c=1.9.4=hcfcfb64_0
- mkl=2022.1.0=h6a75c08_874
- numpy=1.24.3=py39h816b6a6_0
- openjpeg=2.5.0=ha2aaf27_2
- openssl=3.1.0=hcfcfb64_3
- pandas=1.5.3=py39h2ba5b7c_1
- pcraster=4.4.0=py39h4c8a3b8_2
- pcre2=10.40=h17e33f8_0
- pip=23.1.2=pyhd8ed1ab_0
- pixman=0.40.0=h8ffe710_0
- poppler=23.05.0=h45d20d0_1
- poppler-data=0.4.12=hd8ed1ab_0
- postgresql=15.3=hd87cd2b_0
- proj=9.2.0=heca977f_0
- pthreads-win32=2.9.1=hfa6e2cd_3
- python=3.9.16=h4de0772_0_cpython
- python-dateutil=2.8.2=pyhd8ed1ab_0
- python_abi=3.9=3_cp39
- pytz=2023.3=pyhd8ed1ab_0
- qt-main=5.15.8=h2c8576c_11
- setuptools=67.7.2=pyhd8ed1ab_0
- six=1.16.0=pyh6c4a22f_0
- snappy=1.1.10=hfb803bf_0
- sqlite=3.41.2=hcfcfb64_1
- tbb=2021.9.0=h91493d7_0
- tiledb=2.13.2=h3132609_0
- tk=8.6.12=h8ffe710_0
- tzdata=2023c=h71feb2d_0
- ucrt=10.0.22621.0=h57928b3_0
- vc=14.3=hb25d44b_16
- vc14_runtime=14.34.31931=h5081d32_16
- vs2015_runtime=14.34.31931=hed1258a_16
- wheel=0.40.0=pyhd8ed1ab_0
- xerces-c=3.2.4=h63175ca_2
- xz=5.2.6=h8d14728_0
- zlib=1.2.13=hcfcfb64_4
- zstd=1.5.2=h12be248_6
- pip:
- altgraph==0.17.3
- jinja2==3.1.2
- markupsafe==2.1.2
- packaging==23.1
- pefile==2023.2.7
- pyinstaller==5.11.0
- pyinstaller-hooks-contrib==2023.3
- pyinstaller-versionfile==2.1.1
- pywin32-ctypes==0.2.0
- pyyaml==6.0
7 changes: 7 additions & 0 deletions metadata.yml
@@ -0,0 +1,7 @@
Version: version.txt
CompanyName: LabSid/PHA/EPUSP
FileDescription: Rainfall rUnoff Balance Enhanced Model (RUBEM)
InternalName: rubem
LegalCopyright: © 2020-2023 - LabSid/PHA/EPUSP. All rights reserved.
OriginalFilename: rubem.exe
ProductName: RUBEM
23 changes: 0 additions & 23 deletions pyproject.toml

This file was deleted.

Binary file added resources/icon/rubem.ico
Binary file not shown.
48 changes: 48 additions & 0 deletions rubem.spec
@@ -0,0 +1,48 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['./rubem/launcher.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)

exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='rubem',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
version='versionfile.txt',
icon='./resources/icon/rubem.ico')

coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='rubem')
8 changes: 8 additions & 0 deletions rubem/__init__.py
Expand Up @@ -25,3 +25,11 @@
from logging import NullHandler

logging.getLogger(__name__).addHandler(NullHandler())

__author__ = "LabSid PHA EPUSP"
__email__ = "rubem.hydrological@labsid.eng.br"
__copyright__ = "Copyright (C) 2020-2022 - LabSid/PHA/EPUSP"
__license__ = "GPL"
__date__ = "2022-03-23"
__version__ = "0.1.3"
__release__ = "0.1.3"
7 changes: 7 additions & 0 deletions rubem/launcher.py
@@ -0,0 +1,7 @@
# From issue Pyinstaller a package with __main__.py
# https://github.com/pyinstaller/pyinstaller/issues/2560#issuecomment-777257579

from rubem.cli import * # noqa

if __name__ == "__main__":
main() # noqa