Skip to content

Commit

Permalink
Single binary executables (#1330)
Browse files Browse the repository at this point in the history
* Single binary executables / DEB packages.

* Attach single binary executables to the releases
  • Loading branch information
isidentical authored Apr 14, 2022
1 parent 278dfc4 commit dd2c951
Show file tree
Hide file tree
Showing 26 changed files with 511 additions and 180 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/release-linux-standalone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release as Standalone Linux Package

on:
workflow_dispatch:
inputs:
branch:
description: "The branch, tag or SHA to release from"
required: true
default: "master"

release:
types: [released, prereleased]


jobs:
binary-build-and-release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}

- uses: actions/setup-python@v3
with:
python-version: 3.9

- name: Build Artifacts
run: |
cd extras/packaging/linux
./get_release_artifacts.sh
- uses: actions/upload-artifact@v3
with:
name: http
path: extras/packaging/linux/artifacts/dist/http

- uses: actions/upload-artifact@v3
with:
name: httpie.deb
path: extras/packaging/linux/artifacts/dist/*.deb

- uses: actions/upload-artifact@v3
with:
name: httpie.rpm
path: extras/packaging/linux/artifacts/dist/*.rpm

- name: Publish Debian Package
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: extras/packaging/linux/artifacts/dist/httpie-${{ github.event.release.tag_name }}.deb
asset_name: httpie-${{ github.event.release.tag_name }}.deb
asset_content_type: binary/octet-stream

- name: Publish Single Executable
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: extras/packaging/linux/artifacts/dist/http
asset_name: http
asset_content_type: binary/octet-stream
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ MANIFEST
# PyInstaller
# 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
*.manifest

# Installer logs
pip-log.txt
Expand Down Expand Up @@ -151,3 +151,5 @@ dmypy.json

# Windows Chocolatey
*.nupkg

artifacts/
3 changes: 3 additions & 0 deletions docs/markdownlint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# Because we use HTML to hide them on the website.
exclude_rule 'MD002'

# MD007 Allow unordered list indentation
exclude_rule 'MD007'

# MD013 Line length
exclude_rule 'MD013'

Expand Down
27 changes: 14 additions & 13 deletions docs/packaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ You are looking at the HTTPie packaging documentation, where you will find valua

The overall release process starts simple:

1. Do the [PyPI](https://pypi.org/project/httpie/) publication.
2. Then, handle company-related tasks.
3. Finally, follow OS-specific steps, described in documents below, to send patches downstream.

## First, PyPI

Let's do the release on [PyPi](https://pypi.org/project/httpie/).
That is done quite easily by manually triggering the [release workflow](https://github.com/httpie/httpie/actions/workflows/release.yml).

## Then, company-specific tasks
1. Bump the version identifiers in the following places:
- `httpie/__init__.py`
- `docs/packaging/windows-chocolatey/httpie.nuspec`
- `CHANGELOG.md`
2. Commit your changes and make a PR against the `master`.
3. Merge the PR, and tag the last commit with your version identifier.
4. Make a GitHub release (by copying the text in `CHANGELOG.md`)
5. Push that release to PyPI (dispatch the `Release PyPI` GitHub action).
6. Once PyPI is ready, push the release to the Snap, Homebrew and Chocolatey with their respective actions.
7. Go to the [`httpie/debian.httpie.io`](https://github.com/httpie/debian.httpie.io) repo and trigger the package index workflow.

## Company-specific tasks

- Blank the `master_and_released_docs_differ_after` value in [config.json](https://github.com/httpie/httpie/blob/master/docs/config.json).
- Update the [contributors list](../contributors).
Expand All @@ -36,10 +38,9 @@ A more complete state of deployment can be found on [repology](https://repology.
| -------------------------------------------: | -------------- |
| [Arch Linux, and derived](linux-arch/) | trusted person |
| [CentOS, RHEL, and derived](linux-centos/) | trusted person |
| [Debian, Ubuntu, and derived](linux-debian/) | trusted person |
| [Fedora](linux-fedora/) | trusted person |
| :construction: [Homebrew, Linuxbrew](brew/) | **HTTPie** |
| :construction: [MacPorts](mac-ports/) | **HTTPie** |
| [Debian, Ubuntu, and derived](linux-debian/) | **HTTPie** |
| [Homebrew, Linuxbrew](brew/) | **HTTPie** |
| [Snapcraft](snapcraft/) | **HTTPie** |
| [Windows — Chocolatey](windows-chocolatey/) | **HTTPie** |

Expand Down
20 changes: 9 additions & 11 deletions docs/packaging/brew/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ We will discuss setting up the environment, installing development tools, instal

## Overall process

:construction: Work in progress.
The brew deployment is completely automated, and only requires a trigger to [`Release on Homebrew`](https://github.com/httpie/httpie/actions/workflows/release-brew.yml) action
from the release manager.

First, update the current Formula:
If it is needed to be done manually, the following command can be used:

```bash
make brew-deps
# Copy-paste content into downstream/mac/brew/httpie.rb
git add downstream/mac/brew/httpie.rb
git commit -s -m 'Update brew formula to XXX'
```console
$ brew bump-formula-pr httpie --version={TARGET_VERSION}
```

That [GitHub workflow](https://github.com/httpie/httpie/actions/workflows/test-package-mac-brew.yml) will test the formula when `downstream/mac/brew/httpie.rb` is changed in a pull request.

Then, open a pull request with those changes to the [downstream file](https://github.com/Homebrew/homebrew-core/blob/master/Formula/httpie.rb).
which will bump the formala, and create a PR against the package index.

## Hacking

:construction: Work in progress.
Make your changes, test the formula through the [`Test Brew Package`](https://github.com/httpie/httpie/actions/workflows/test-package-mac-brew.yml) action
and then finally submit your patch to [`homebrew-core`](https://github.com/Homebrew/homebrew-core`)

81 changes: 0 additions & 81 deletions docs/packaging/brew/brew-deps.py

This file was deleted.

24 changes: 12 additions & 12 deletions docs/packaging/brew/httpie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ class Httpie < Formula

desc "User-friendly cURL replacement (command-line HTTP client)"
homepage "https://httpie.io/"
url "https://files.pythonhosted.org/packages/7b/f9/13070f19226b7db3641fb787df36bb715063abe1b8ca03fbaeca0f465d27/httpie-3.0.1.tar.gz"
sha256 "0e9bc93ebdcdd2d32ec24b8fa46cf7e4fde9eec7a6bd0c5d0ef224f25d7466b2"
url "https://files.pythonhosted.org/packages/32/85/bb095699be20cc98731261cb80884e9458178f8fef2a38273530ce77c0a5/httpie-3.1.0.tar.gz"
sha256 "2e4a2040b84a912e65c01fb34f7aafe88cad2a3af2da8c685ca65080f376feda"
license "BSD-3-Clause"
head "https://github.com/httpie/httpie.git", branch: "master"

bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "9d285fcfb55ce8ed787d1b01966d51e6e07f7e77c44a204695a2d6eee9c8698d"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "743a282b475e87a4eaf11e545f761aef1b8e4bfe49eaee47251d7629a35a8ced"
sha256 cellar: :any_skip_relocation, monterey: "5d63ea4f47b2028b2ba68abe12a4176934193e058edd869270221b41cc946c76"
sha256 cellar: :any_skip_relocation, big_sur: "5a53221a680a35d1aa00cbadde279dbe4f562d22ed207c15bd4221cb8c3180f1"
sha256 cellar: :any_skip_relocation, catalina: "5feadb6d76f55d6f9681682e221008c282dccf0e46ae22a959b4bad2efde204a"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d530ddbec49588b0d481f156d35f7e5bb7d3b6427d203f04750e55cd3eecc303"
sha256 cellar: :any_skip_relocation, arm64_monterey: "9bb6e8c1ef5ba8b019ddedd7e908dd2174da695351aa9a238dfb28b0f57ef005"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "47ffccd3241155d863e1b4f6259d538a34d42a0cdeed8152bda257ee607b51be"
sha256 cellar: :any_skip_relocation, monterey: "dc4a04cb05a9cd1bfa6a632a0e4a21975905954af54ece41f9050c52474267be"
sha256 cellar: :any_skip_relocation, big_sur: "ae469e37864e967e0fd99fba15a78e719dcb351b462f98f3843c78ed1473df6d"
sha256 cellar: :any_skip_relocation, catalina: "291a3eaecb2a2cc845c1652686a9a14b21053d7e3a7d0115245b2150ca2e199e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "710836e27c44c8e3ad181d668f4a9f78c4cb4c355d7b148a397599a7cd42713d"
end

depends_on "[email protected]"
Expand All @@ -25,8 +25,8 @@ class Httpie < Formula
end

resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/48/44/76b179e0d1afe6e6a91fd5661c284f60238987f3b42b676d141d01cd5b97/charset-normalizer-2.0.10.tar.gz"
sha256 "876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd"
url "https://files.pythonhosted.org/packages/56/31/7bcaf657fafb3c6db8c787a865434290b726653c912085fbd371e9b92e1c/charset-normalizer-2.0.12.tar.gz"
sha256 "2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"
end

resource "defusedxml" do
Expand All @@ -40,8 +40,8 @@ class Httpie < Formula
end

resource "multidict" do
url "https://files.pythonhosted.org/packages/8e/7c/e12a69795b7b7d5071614af2c691c97fbf16a2a513c66ec52dd7d0a115bb/multidict-5.2.0.tar.gz"
sha256 "0dd1c93edb444b33ba2274b66f63def8a327d607c6c790772f448a53b6ea59ce"
url "https://files.pythonhosted.org/packages/fa/a7/71c253cdb8a1528802bac7503bf82fe674367e4055b09c28846fdfa4ab90/multidict-6.0.2.tar.gz"
sha256 "5ff3bd75f38e4c43f1f470f2df7a4d430b821c4ce22be384e1459cb57d6bb013"
end

resource "Pygments" do
Expand Down
6 changes: 6 additions & 0 deletions docs/packaging/brew/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -xe

rm -f httpie.rb
http --download https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/httpie.rb
21 changes: 9 additions & 12 deletions docs/packaging/linux-debian/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@ Welcome to the documentation about **packaging HTTPie for Debian GNU/Linux**.
This document contains technical details, where we describe how to create a patch for the latest HTTPie version for Debian GNU/Linux. They apply to Ubuntu as well, and any Debian-derived distributions like MX Linux, Linux Mint, deepin, Pop!_OS, KDE neon, Zorin OS, elementary OS, Kubuntu, Devuan, Linux Lite, Peppermint OS, Lubuntu, antiX, Xubuntu, etc.
We will discuss setting up the environment, installing development tools, installing and testing changes before submitting a patch downstream.

The current maintainer is Bartosz Fenski.
We create the standalone binaries (see this [for more details](../../../extras/packaging/linux/)) and package them with
[FPM](https://github.com/jordansissel/fpm)'s `dir` mode. The core `http`/`https` commands don't have any dependencies, but the `httpie`
command (due to the underlying `httpie cli plugins` interface) explicitly depends to the system Python (through `python3`/`python3-pip`).

## Overall process

Open a new bug on the Debian Bug Tracking System by sending an email:
The [`Release as Standalone Linux Binary`](https://github.com/httpie/httpie/actions/workflows/release-linux-standalone.yml) will be automatically
triggered when a new release is created, and it will submit the `.deb` package as a release asset.

- To: `Debian Bug Tracking System <[email protected]>`
- Subject: `httpie: Version XXX available`
- Message template (examples [1](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993937), and [2](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996479)):

```email
Package: httpie
Severity: normal
<MESSAGE>
```
For making that asset available for all debian users, the release manager needs to go to the [`httpie/debian.httpie.io`](https://github.com/httpie/debian.httpie.io) repo
and trigger the [`Update Index`](https://github.com/httpie/debian.httpie.io/actions/workflows/update-index.yml) action. It will automatically
scrape all new debian packages from the release assets, properly update the indexes and create a new PR ([an example](https://github.com/httpie/debian.httpie.io/pull/1))
which then will become active when merged.
6 changes: 5 additions & 1 deletion docs/packaging/linux-fedora/httpie.spec.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: httpie
Version: 3.0.2
Version: 3.1.0
Release: 1%{?dist}
Summary: A Curl-like tool for humans

Expand Down Expand Up @@ -78,6 +78,10 @@ help2man %{buildroot}%{_bindir}/httpie > %{buildroot}%{_mandir}/man1/httpie.1


%changelog
* Tue Mar 08 2022 Miro Hrončok <[email protected]> - 3.1.0-1
- Update to 3.1.0
- Fixes: rhbz#2061597

* Mon Jan 24 2022 Miro Hrončok <[email protected]> - 3.0.2-1
- Update to 3.0.2
- Fixes: rhbz#2044572
Expand Down
6 changes: 6 additions & 0 deletions docs/packaging/linux-fedora/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -xe

rm -f httpie.spec.txt
https --download src.fedoraproject.org/rpms/httpie/raw/rawhide/f/httpie.spec -o httpie.spec.txt
11 changes: 10 additions & 1 deletion docs/packaging/snapcraft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ We will discuss setting up the environment, installing development tools, instal

## Overall process

Trigger a new [build](https://snapcraft.io/httpie/builds), then [promote it](https://snapcraft.io/httpie/releases). If more management is needed: [revisions supervision](https://dashboard.snapcraft.io/snaps/httpie/revisions/).
Trigger the [`Release on Snap`](https://github.com/httpie/httpie/actions/workflows/release-snap.yml) action, which will
create a snap package for HTTPie and then push it to Snap Store in the following channels:

- Edge
- Beta
- Candidate
- Stable

If a push to any of them fail, all the release tasks for the following channels will be cancelled so that the
release manager can look into the underlying cause.

## Hacking

Expand Down
7 changes: 6 additions & 1 deletion docs/packaging/windows-chocolatey/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ We will discuss setting up the environment, installing development tools, instal

## Overall process

After having successfully [built and tested](#hacking) the package, push it:
After having successfully [built and tested](#hacking) the package, either trigger the
[`Release on Chocolatey`](https://github.com/httpie/httpie/actions/workflows/release-choco.yml) action
to push it to the `Chocolatey` store or use the CLI:

```bash
# Replace 2.5.0 with the correct version
choco push httpie.2.5.0.nupkg -s https://push.chocolatey.org/ --api-key=API_KEY
```

Be aware that it might take multiple days until the release is approved, sine it goes through multiple
sets of reviews (some of them are done manually).

## Hacking

```bash
Expand Down
Loading

0 comments on commit dd2c951

Please sign in to comment.