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

Add sanity check to executable CD + more #3190

Merged
merged 1 commit into from
Jul 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/upload_binary.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: Upload self-contained binaries
name: Publish executables

on:
release:
types: [published]

permissions:
contents: read
contents: write # actions/upload-release-asset needs this.

jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -38,15 +36,21 @@ jobs:
with:
python-version: "*"

- name: Install dependencies
- name: Install Black and PyInstaller
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install .
python -m pip install --upgrade pip wheel
python -m pip install .[colorama]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is colorama huge / can it break platforms? Should we just default to it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it's incredibly tiny.
image

And it's a no-op on platforms that isn't Windows with how we're using it. Colorama isn't really necessary on modern Windows systems if you use the modern Windows terminal, but the legacy CMD terminal (which is still commonly used) does not support ANSI colour codes.

python -m pip install pyinstaller

- name: Build binary
- name: Build executable with PyInstaller
run: >
python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data
'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py

- name: Quickly test executable
run: |
python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data 'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py
./dist/${{ matrix.asset_name }} --version
./dist/${{ matrix.asset_name }} src --verbose

- name: Upload binary as release asset
uses: actions/upload-release-asset@v1
Expand Down