Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Keep in sync with donjon-painter.
  • Loading branch information
Blackflighter committed Aug 6, 2020
2 parents c700d94 + ee678a6 commit 7f1952e
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 31 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
128 changes: 128 additions & 0 deletions .github/workflows/build-executables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Build Executables

on:
push:
tags:
- "v*"

jobs:

job_build:
name: ${{ matrix.os }} Binaries
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
include:
- os: ubuntu
add-data: 'themes:themes'
- os: macos
add-data: 'themes:themes'
- os: windows
add-data: 'themes;themes'
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Build Executable
run: |
mkdir ${{ matrix.os }}
cd donjon_painter
python -O -m PyInstaller --clean --onefile --add-data="${{ matrix.add-data }}" --name donjon-painter --distpath ../${{ matrix.os }} painter.py
- name: Package Executable
run: |
mv ./LICENSE ./${{ matrix.os }}
mv ./README.rst ./${{ matrix.os }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: ${{ matrix.os }}


job_upload:
name: Upload Release Assets
needs: job_build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

# Github Actions is weird about environment variables.
# Setting a variable in this way makes it available to all subsequent steps in the job.
# The only way to get the tag is to extract it from github-ref.
# For example, GITHUB_REF='refs/tags/v1.5'.
- name: Set environment
run: |
export TAG="${GITHUB_REF#'refs/tags/'}"
echo "::set-env name=GH_TAG::$TAG"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false

- uses: actions/download-artifact@v2
with:
path: bin/

# Zip all artifacts
- name: Zip Archives
run: |
cd bin
chmod +x ./macos/donjon-painter
chmod +x ./ubuntu/donjon-painter
for idir in */;
do
(cd "$idir" && zip -r "../${idir%/}.zip" .);
done
# We have to upload assets individually using upload-release-asset@v1
# There isn't a matrix for steps.
- name: Upload Linux Release
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: ./bin/ubuntu.zip
asset_name: donjon-painter-linux-${{ env.GH_TAG }}.zip
asset_content_type: application/zip

- name: Upload MacOS Release
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: ./bin/macos.zip
asset_name: donjon-painter-macos-${{ env.GH_TAG }}.zip
asset_content_type: application/zip

- name: Upload Windows Release
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: ./bin/windows.zip
asset_name: donjon-painter-windows-${{ env.GH_TAG }}.zip
asset_content_type: application/zip
52 changes: 25 additions & 27 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
donjon-painter - Dungeon Map Maker
==================================

donjon-painter is a companion script to `donjon's Random Dungeon Generator`_. By selecting a TSV file along with a set of tile assets, you can easily create large, beautiful dungeon maps. Learn how to create new tilesets for donjon-painter `here`_.
This is a fork of the outdated `Blackflighter/donjon-painter`_.

donjon-painter is a companion script to `donjon's Random Dungeon Generator`_.
By selecting a TSV file along with a set of tile assets, you can easily create large, beautiful dungeon maps.
Learn how to create new tilesets for donjon-painter `here`_.

.. _Blackflighter/donjon-painter: https://github.com/Blackflighter/donjon-painter
.. _donjon's Random Dungeon Generator: https://donjon.bin.sh/fantasy/dungeon/
.. _here: https://github.com/Blackflighter/donjon-painter/blob/master/CONTRIBUTING.rst
.. _here: https://github.com/donjon-painter/donjon-painter/blob/master/CONTRIBUTING.rst

-------------
Prerequisites
Expand All @@ -16,38 +21,31 @@ Prerequisites
Installation
============

-----------
Windows EXE
-----------
Windows users have the option of downloading an EXE version of the script, which can be found `over here`_. If you wish to run the EXE in the terminal often, you can edit your `PATH`_ environment variable so you don't need to navigate to the program first.
The packages provided in pyPI and the AUR are outdated.

.. _over here: https://github.com/Blackflighter/donjon-painter/releases/
.. _PATH: https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/
---------------
Linux and MacOS
---------------

------------------------
AUR Package (Arch Linux)
------------------------
If you're using Arch Linux, get the PKGBUILD `from here`_.
Download the appropriate executable from `the releases page`_.
Then extract the archive and run in the terminal.

.. _from here: https://aur.archlinux.org/packages/donjon-painter/
::

----------------------
RPM File (RHEL/Fedora)
----------------------
`Download the requisite RPM file`_.
donjon-painter

.. _Download the requisite RPM file: https://github.com/Blackflighter/donjon-painter/releases/
.. _the releases page: https://github.com/donjon-painter/donjon-painter/releases/

---------
Using pip
---------
donjon-painter is `available on PyPI`_. Get it using this command:
-----------
Windows EXE
-----------
Windows users have the option of downloading an EXE version of the script, which can be found `over here`_.
If you wish to run the EXE in the terminal often, you can edit your `PATH`_ environment variable so you don't need to navigate to the program first.

::
.. _over here: https://github.com/donjon-painter/donjon-painter/releases/
.. _PATH: https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/

pip install --user --upgrade donjon-painter

.. _available on PyPI: https://pypi.org/project/donjon-painter/

--------
setup.py
Expand All @@ -67,7 +65,7 @@ Usage
-------------------------
First of all, begin by heading to `donjon's Random Dungeon Generator`_ to generate the dungeon of your liking. Having done that, you should select the option to download a TSV map of the generated file, as depicted below:

.. image:: https://raw.githubusercontent.com/Blackflighter/donjon-painter/master/res/donjon.png
.. image:: https://raw.githubusercontent.com/donjon-painter/donjon-painter/master/res/donjon.png
.. _donjon's Random Dungeon Generator: https://donjon.bin.sh/fantasy/dungeon/

------------------
Expand All @@ -94,7 +92,7 @@ Creating a map in interactive mode is a fairly simple process. You'll be given a

At minimum, you must select your TSV file of choice, along with the theme you would like to use. Other options can be toggled/set if you'd like some further customisation.

.. image:: https://raw.githubusercontent.com/Blackflighter/donjon-painter/master/res/interactive.png
.. image:: https://raw.githubusercontent.com/donjon-painter/donjon-painter/master/res/interactive.png

Options
=======
Expand Down
2 changes: 1 addition & 1 deletion devel/build-win.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyinstaller --name="donjon-painter-0.9.4" --paths="../donjon_painter" --add-data="../donjon_painter/themes;themes" --distpath="../dist" --upx-dir="./upx-3.95-win32" --workpath="../build" --onefile ..\donjon_painter\painter.py
pyinstaller --name="donjon-painter-0.9.5" --paths="../donjon_painter" --add-data="../donjon_painter/themes;themes" --distpath="../dist" --upx-dir="./upx-3.95-win32" --workpath="../build" --onefile ..\donjon_painter\painter.py
2 changes: 1 addition & 1 deletion devel/pip-testupload.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

version=0.9.4
version=0.9.5

twine upload --repository-url https://test.pypi.org/legacy/ ../dist/donjon_painter-$version-py3-none-any.whl ../dist/donjon-painter-$version.tar.gz
2 changes: 1 addition & 1 deletion devel/pip-upload.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

version=0.9.4
version=0.9.5

twine upload ../dist/donjon_painter-$version-py3-none-any.whl ../dist/donjon-painter-$version.tar.gz
7 changes: 7 additions & 0 deletions donjon_painter/test_sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# content of test_sample.py
def func(x):
return x + 1


def test_answer():
assert func(3) == 4
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name='donjon-painter',
version='0.9.4',
version='0.9.5',
author='Korvin Roganov',
author_email='[email protected]',
license='GPLv3',
Expand Down

0 comments on commit 7f1952e

Please sign in to comment.