build and release v0.1.2 #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Standalone Executables with Nuitka | |
on: | |
push: | |
branches: | |
- dev01 | |
pull_request: | |
branches: | |
- dev01 | |
env: | |
RELEASE_VERSION: "v0.1.2" | |
RELEASE_DESCRIPTION: | | |
This blockperf release includes standalone x86_64 and arm64 Linux executables for: | |
- Python 3.8 on Ubuntu 20.04 LTS | |
- Python 3.10 on Ubuntu 22.04 LTS | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.10"] # Python versions are strings | |
architecture: [x86_64, arm64] | |
os: [ubuntu-20.04, ubuntu-22.04] | |
exclude: | |
- python-version: "3.8" | |
os: ubuntu-22.04 | |
- python-version: "3.10" | |
os: ubuntu-20.04 | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y patchelf | |
pip install nuitka paho-mqtt psutil | |
- name: Build the executable with Nuitka (Static libpython) | |
run: | | |
cd src | |
python -m nuitka --onefile --standalone --include-module=paho.mqtt.client --include-module=psutil --output-dir=../build --output-filename=oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }} --static-libpython=yes blockperf/cli.py | |
- name: Package the output | |
run: | | |
cd build | |
mv oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }} oblockperf | |
zip oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }}.zip oblockperf | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }}" | |
path: build/oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }}.zip | |
create_release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create a release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ env.RELEASE_VERSION }} | |
release_name: ${{ env.RELEASE_VERSION }} | |
body: ${{ env.RELEASE_DESCRIPTION }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download artifact for Python "3.8" (x86_64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: "oblockperf_3.8_x86_64" | |
path: ./artifacts | |
- name: Download artifact for Python "3.8" (arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: "oblockperf_3.8_arm64" | |
path: ./artifacts | |
- name: Download artifact for Python "3.10" (x86_64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: "oblockperf_3.10_x86_64" | |
path: ./artifacts | |
- name: Download artifact for Python "3.10" (arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: "oblockperf_3.10_arm64" | |
path: ./artifacts | |
- name: Upload Python "3.8" (x86_64) artifact to the release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/oblockperf_3.8_x86_64.zip | |
asset_name: oblockperf_3.8_x86_64.zip | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Python "3.8" (arm64) artifact to the release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/oblockperf_3.8_arm64.zip | |
asset_name: oblockperf_3.8_arm64.zip | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Python "3.10" (x86_64) artifact to the release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/oblockperf_3.10_x86_64.zip | |
asset_name: oblockperf_3.10_x86_64.zip | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Python "3.10" (arm64) artifact to the release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/oblockperf_3.10_arm64.zip | |
asset_name: oblockperf_3.10_arm64.zip | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |