ArtificialQualia / PyEveLiveDPS

PyEveLiveDPS (PELD) is a live DPS calculator and grapher for EVE Online
GNU General Public License v3.0
162 stars 28 forks source link

Added automated Windows builds via Appveyor. #1

Closed TomRichter closed 7 years ago

TomRichter commented 7 years ago

This pull requests adds automated Windows builds of PELD via AppVeyor. The result is automatically packaged and uploaded to GitHub Releases with each tagged commit.

Why?

Automatic builds are awesome. No need to waste your own time or bandwidth, and no getting stuck when The One Who Can Build goes missing or breaks their local config. This frees up development time and makes collaboration easier.

AppVeyor was chosen because pyinstaller requires an actual Windows environment when freezing for Windows, but popular alternatives like Travis CI only offer Mac or Linux. Luckily, AppVeyor has similar syntax to Travis CI and is free for open source projects.

How to use?

AppVeyor is configured via the appveyor.yml file. Currently, it automatically builds on tag and pushes the zipped executable and README back to GitHub Releases.

Whenever it's time for a new release, simply push a tag so AppVeyor takes notice. This is already being done with PELD, so no change in workflow is required (except not manually building and uploading).

Edit the release on GitHub afterwards to add patch notes, if applicable. Else the release description may default to a blank message or the latest commit message.

What's left to do?

Automatic builds need to be enabled at AppVeyor and the auth_token needs to be set from a GitHub account with write access to the repo.

Configuring AppVeyor

  1. Log in at AppVeyor using your GitHub credentials.
  2. Click (+) New Project in the top left, then GitHub > Authorize GitHub for public projects.
  3. Back in AppVeyor, mouse over PyEveLiveDps and click (+) Add on the far right.

Configuring auth_token

  1. Log in at AppVeyor using your GitHub credentials.
  2. On GitHub, generate a new access token:
    1. Click Generate new token in the top right.
    2. Name it AppVeyor and check public_repo.
    3. Copy the resulting token somewhere safe.
  3. On AppVeyor, encrypt the token for safe use in the config file:
    1. Paste the previously generated token and click Encrypt.
    2. In appveyor.yml, set auth_token: secure: to the encrypted token from last step. DO NOT use the unencrypted token here or bad things can happen to your repos!
    3. Commit and tag the change containing the updated auth token, then push.

From here on, AppVeyor will autonomously process each tagged commit without further intervention.

ArtificialQualia commented 7 years ago

Hey @TomRichter,

This is a nice addition, and makes CI/CD easy, but more importantly you are right that it's important to allow non-windows users to build this project.

I've tested it out, and it seems to work great!

If you don't mind, I'll take some of the notes you made here about how to configure AppVeyor and throw it into a BUILDING.md or CONTRIBUTING.md so others will be able to test this easily as well.

TomRichter commented 7 years ago

Sure, do whatever makes it easier for you. Let me know if you have any questions.

Thanks for the merge!

TomRichter commented 7 years ago

By the way, don't forget to update the token in appveyor.yml on the line with auth_token: secure:. This is something you have to do yourself since the existing token doesn't have correct permissions. Otherwise, it will continue to fail automatically building and uploading to Releases.

ArtificialQualia commented 7 years ago

Yeah, I have actually. It's updated on the dev branch. I actually modified the script to create both an installable version and a standalone, and have confirmed it is working.

TomRichter commented 7 years ago

Oops, missed that. Sounds awesome!