build and release v0.1.0 #26
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.0" | |
RELEASE_DESCRIPTION: | | |
This blockperf release includes standalone x86_64 and arm64 Linux executables for systems on: | |
- Python 3.8 | |
- Python 3.10 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.10'] | |
architecture: [x86_64, arm64] # Add both architectures | |
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 | |
- name: Build the executable with Nuitka (Static libpython) | |
run: | | |
cd src | |
python -m nuitka --onefile --standalone --include-module=paho.mqtt.client --output-dir=../build --output-filename=oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }} --static-libpython=yes blockperf/cli.py | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }}" # Use underscores consistently | |
path: build/oblockperf_${{ matrix.python-version }}_${{ matrix.architecture }} | |
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" # Use underscores consistently | |
path: ./artifacts | |
- name: Download artifact for Python 3.8 (arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: "oblockperf_3.8_arm64" # Use underscores consistently | |
path: ./artifacts | |
- name: Download artifact for Python 3.10 (x86_64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: "oblockperf_3.10_x86_64" # Use underscores consistently | |
path: ./artifacts | |
- name: Download artifact for Python 3.10 (arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: "oblockperf_3.10_arm64" # Use underscores consistently | |
path: ./artifacts | |
- name: List files for debugging | |
run: ls -R ./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 # Use underscores consistently | |
asset_name: oblockperf_3.8_x86_64 | |
asset_content_type: application/octet-stream | |
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 # Use underscores consistently | |
asset_name: oblockperf_3.8_arm64 | |
asset_content_type: application/octet-stream | |
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 # Use underscores consistently | |
asset_name: oblockperf_3.10_x86_64 | |
asset_content_type: application/octet-stream | |
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 # Use underscores consistently | |
asset_name: oblockperf_3.10_arm64 | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |