Skip to content

Commit

Permalink
Merge branch 'packaging'
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Jun 30, 2024
2 parents 9d2e2d9 + 233be55 commit 657ce31
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 85 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
required: false
default: ''
publish:
description: 'Set to "false" to skip publishing to PyPI'
description: 'Publish package to PyPI'
required: false
default: 'true'

Expand All @@ -29,7 +29,7 @@ jobs:
build-app-packages:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
fail-fast: false
defaults:
run:
Expand All @@ -46,7 +46,7 @@ jobs:

# Install binary + python dependencies
- name: Install system packages
if: ${{ matrix.os == 'ubuntu-latest' }}
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install -y '^libxcb.*-dev' libegl-dev libwebp-dev libpng16-16 libx11-xcb-dev rpm
- name: Cache python packages
id: cache
Expand All @@ -57,15 +57,15 @@ jobs:
- name: Install python packages
if: steps.cache.outputs.cache-hit != 'true'
run: |
poetry install -v --without dev
poetry install -v --only main
poetry run pip install -U pyinstaller setuptools
- name: Build pyinstaller package
run: poetry run pyinstaller -y packaging/naturtag.spec

# Include taxon FTS db, compress, and set platform name
- name: Finish pyinstaller package (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
if: startsWith(matrix.os, 'ubuntu')
run: |
ASSETS=dist/naturtag/_internal/assets/data
tar -xvzf $ASSETS/taxonomy.tar.gz --directory $ASSETS/
Expand All @@ -74,7 +74,7 @@ jobs:
echo "DIST_NAME=linux" >> $GITHUB_ENV
- name: Finish pyinstaller package (macOS)
if: ${{ matrix.os == 'macos-latest' }}
if: startsWith(matrix.os, 'macos')
run: |
ASSETS=dist/naturtag.app/Contents/Resources/assets/data
tar -xvzf $ASSETS/taxonomy.tar.gz --directory $ASSETS/
Expand All @@ -83,7 +83,7 @@ jobs:
echo "DIST_NAME=macos" >> $GITHUB_ENV
- name: Finish pyinstaller package (Windows)
if: ${{ matrix.os == 'windows-latest' }}
if: startsWith(matrix.os, 'windows')
run: |
ASSETS=dist/naturtag/_internal/assets/data
tar -xvzf $ASSETS/taxonomy.tar.gz --directory $ASSETS/
Expand All @@ -93,7 +93,7 @@ jobs:
# Build deb, snap, and rpm packages
- name: Build Linux packages with FPM
if : ${{ matrix.os == 'ubuntu-latest' }}
if : startsWith(matrix.os, 'ubuntu')
run: |
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export PATH="$PATH:$GEM_HOME/bin"
Expand All @@ -103,7 +103,7 @@ jobs:
# Build dmg package
- name: Build disk image (macOS)
if: ${{ matrix.os == 'macos-latest' }}
if: startsWith(matrix.os, 'macos')
run: |
brew install create-dmg
cd packaging
Expand All @@ -117,14 +117,14 @@ jobs:
path: naturtag-${{ env.DIST_NAME }}.tar.gz

- name: Upload disk image (macOS)
if: ${{ matrix.os == 'macos-latest' }}
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: naturtag.dmg
path: dist/naturtag.dmg

- name: Upload FPM workflow artifacts (Linux)
if : ${{ matrix.os == 'ubuntu-latest' }}
if : startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v4
with:
name: naturtag-fpm
Expand Down
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* In refresh mode, check for taxonomy changes and update tags with the new taxon (1:1 changes only)

**Database:**
* Update packaged taxonomy db with iNaturalist data from June 2024
* Include data for most commonly observed taxa with PyInstaller packages and platform-specific installers
* Pre-compute ancestor IDs, child IDs, iconic taxon, observation count, and leaf taxon count based
on RG observations from GBIF export
Expand Down
Binary file modified assets/data/taxonomy.tar.gz
Binary file not shown.
14 changes: 12 additions & 2 deletions packaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@ This directory contains scripts and config for building Naturtag packages in the
* Taxonomy full text search database (optional download)

# Release steps

## Build taxonomy db
* Locally build full taxonomy FTS database with `build_taxon_db.py`. For reference, see:
* [pyinaturalist_convert.dwca](https://pyinaturalist-convert.readthedocs.io/en/stable/modules/dwca.html)
* [pyinaturalist_convert.taxonomy](https://pyinaturalist-convert.readthedocs.io/en/stable/modules/taxonomy.html)
* [pyinaturalist_convert.fts](https://pyinaturalist-convert.readthedocs.io/en/stable/modules/fts.html)
* Export subset of db (English language, common species only) with `export_taxa.sh`
* Commit to repo under `assets/data/taxonomy.tar.gz`
* Export full db with `export_taxa_full.sh`
* This will create a file `taxonomy-full.tar.gz` to upload later

## Windows Installer
* Update version in `pyproject.toml` and Actual Installer config (`naturtag.aip`)
* On a Windows machine or VM, build the project locally and create an installer with Actual Installer.
* See steps in `build_win.ps1` for details (not fully automated; requires GUI interaction)

## Release
* Create and push new git tag. This will trigger jobs to build packages and create a new GitHub release.
* Export full db with `export_taxa_full.sh`
* After the release jobs complete, manually upload this to the release assets
* Manually upload full taxonomy db (`taxonomy-full.tar.gz`) to the new release's assets
* Manually upload Windows installer (`naturtag-installer.exe`) to the new release's assets
12 changes: 5 additions & 7 deletions packaging/build_win.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Build pyinstaller package prior to creating Windows installer

# Create virtualenv
# python -m venv $env:USERPROFILE\.virtualenvs\naturtag
# Create virtualenv (if needed)
# python3.11 -m venv $env:USERPROFILE\.virtualenvs\naturtag

# Install poetry
# Install poetry (if needed)
# Invoke-WebRequest -Uri https://install.python-poetry.org -OutFile install-poetry.py
# python install-poetry.py --preview
# ~\AppData\Roaming\Python\Scripts\poetry.exe config virtualenvs.create false

# Install dependencies
. ~\.virtualenvs\naturtag\Scripts\activate.ps1
poetry install -v --no-dev
poetry self update
poetry install -v --only main
pip install -U setuptools pyinstaller
pyinstaller -y packaging\naturtag.spec

Expand All @@ -19,6 +20,3 @@ pyinstaller -y packaging\naturtag.spec
# 2. Run installer
# 3. Open Naturtag and test basic features
Invoke-Item packaging\naturtag.aip

# Launch InstallForge
# Invoke-Item packaging\naturtag.ifp
21 changes: 17 additions & 4 deletions packaging/naturtag.aip
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[Setup]
AIVersion=9.3
AIVersion=10.0
AIEdition=1
GUID={01329D81-576C-42FE-9850-9C4C03F161FB}
AppName=Naturtag
AppEdition=
AppVersion=v0.8.0-beta
GetVerFromExe=0
AppDescription=
CompanyName=
WebSite=https://naturtag.readthedocs.io
SupportLink=https://naturtag.readthedocs.io
Copyright=Copyright © 2024 Jordan Cook
GetCopyrightFromExe=0
InstallLevel=1
UpgradeMode=0
IfInstalled=0
Expand Down Expand Up @@ -51,12 +55,15 @@ UninstallCloseMainExe=1
UninstallCloseApp=0
UninstallCloseAppFile=File.exe
UninstallCloseAppText=App
UninstallForceCloseApp=0
Updater=1
UpdateURL=https://raw.githubusercontent.com/pyinat/naturtag/main/packaging/latest.txt
CheckUpdateBefore=0
CheckUpdaterTitle=0
CheckUseDownloader=0
AllowChangeUpdate=0
GetVerFrom=2
UpdateMethod=0
CheckUseDownloader=0
AutoCheckUpdate=0
UpdateFrequency=2
AutoSilentUpdate=0
Expand All @@ -67,6 +74,7 @@ CheckUpdatePassParam=0
CheckUpdaterParam=?id=<AppVersion>
UpdaterParameters=
LaunchOnStatup=0
RegisterAppPath=0
SelectFolderMode=0
AltInstallDir=<AppData>\<AppName>
DataExtractParam=-o"<InstallDir>" -aoa
Expand Down Expand Up @@ -99,18 +107,22 @@ HideOtherLanguages=0
QueryText=0
QueryTextName=
QueryTextReq=0
QueryTextDis=0
QueryTextHide=0
QueryCustom=0
QueryCustomName=
QueryCustomReq=0
QueryCustomDis=0
QueryCustomHide=0
QueryCustomType=0
QueryCustomMustExists=0
QueryKey=0
QueryKeyName=Key:
QueryKeyReq=0
QueryKeyDis=0
QueryKeyHide=0
QueryKeyHideReg=0
QueryKeyHidePass=0
KeysCount=0
InfoCustomBox=0
InfoCustomBoxReq=0
Expand All @@ -120,6 +132,7 @@ CustomComboBoxName=
CustomComboBoxItems=
CustomComboDefItem=
ComboBoxDisableOnUpgrade=0
ComboBoxUpdateInstallDir=0
CustomComponents=0
CustomComponentsText=
CustomComponentsDesc=
Expand All @@ -139,8 +152,8 @@ CustomActionCommand=<WebSite>
CustomActionChecked=0
CustomActionAdmin=0
TotalFiles=2
SourceDirFiles=1050
SourceDirSize=162253011
SourceDirFiles=472
SourceDirSize=168013728

[GUI]
FontName=Verdana
Expand Down
Loading

0 comments on commit 657ce31

Please sign in to comment.