Skip to content

release test

release test #14

name: Release BenchMesh App
on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v1.0.0
workflow_dispatch: # Allows manual trigger
permissions:
contents: write # Required to create releases and upload assets
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install frontend dependencies
run: |
cd benchmesh-serial-service/frontend
npm ci
- name: Run frontend tests
run: |
cd benchmesh-serial-service/frontend
npm run test -- --run
- name: Build frontend
run: |
cd benchmesh-serial-service/frontend
npm run build
- name: Install backend dependencies
run: |
cd benchmesh-serial-service
pip install -r requirements.txt
pip install pytest
- name: Run backend tests
run: |
cd benchmesh-serial-service
python -m pytest -v
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version from tag
id: get_version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
create-release:
needs: [run-tests, get-version]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PRERELEASE=""
if [[ "${{ needs.get-version.outputs.version }}" == *"alpha"* ]] || \
[[ "${{ needs.get-version.outputs.version }}" == *"beta"* ]] || \
[[ "${{ needs.get-version.outputs.version }}" == *"rc"* ]]; then
PRERELEASE="--prerelease"
fi
gh release create ${{ github.ref_name }} \
--title "BenchMesh ${{ needs.get-version.outputs.version }}" \
$PRERELEASE \
--notes "## BenchMesh Release ${{ needs.get-version.outputs.version }}
### Downloads
#### Electron Desktop Applications
- **Linux**: AppImage (portable) or .deb (Debian/Ubuntu installer)
- **Windows**: .exe installer or portable
- **macOS**: .dmg (drag-and-drop) or .zip
#### Self-Hosted Web Application
- Download \`benchmesh-web-${{ needs.get-version.outputs.version }}.tar.gz\`
- Extract and run \`./start.sh\`
### Installation
**Electron App:**
- Linux: \`chmod +x BenchMesh-*.AppImage && ./BenchMesh-*.AppImage\`
- Windows: Run the installer or portable .exe
- macOS: Open .dmg and drag to Applications
**Self-Hosted:**
\`\`\`bash
tar -xzf benchmesh-web-*.tar.gz
cd benchmesh
npm install
cd benchmesh-serial-service && pip install -r requirements.txt
cd .. && ./start.sh
\`\`\`
### What's New
See [CHANGELOG.md](CHANGELOG.md) for details.
### Requirements
- Python 3.8+
- Node.js 18+ (development only for self-hosted)
- Serial port access for instrument communication"
build-linux:
needs: [create-release, get-version]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libdrm2 libgbm1 libxcb-dri3-0
- name: Install Node dependencies
run: |
npm install
cd benchmesh-serial-service/frontend
npm ci
cd ../..
- name: Ensure .node-red directory exists
run: |
mkdir -p .node-red
echo '{}' > .node-red/.config.nodes.json
echo '{}' > .node-red/.config.runtime.json
- name: Build frontend
run: |
cd benchmesh-serial-service/frontend
npm run build
cd ../..
- name: Install Electron dependencies
run: |
cd electron
npm install
- name: Update version in electron package.json
run: |
cd electron
CURRENT_VERSION=$(node -p "require('./package.json').version")
TARGET_VERSION="${{ needs.get-version.outputs.version }}"
if [ "$CURRENT_VERSION" != "$TARGET_VERSION" ]; then
npm version $TARGET_VERSION --no-git-tag-version --allow-same-version
else
echo "Version already set to $TARGET_VERSION, skipping"
fi
- name: Build Electron app (Linux)
run: |
cd electron
npm run build:linux
- name: List built files
run: |
echo "Contents of dist directory:"
ls -la dist/
- name: Upload Linux Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Find the actual AppImage and DEB files
APPIMAGE_FILE=$(find ./dist -name "*.AppImage" -type f | head -1)
DEB_FILE=$(find ./dist -name "*.deb" -type f | head -1)
if [ -n "$APPIMAGE_FILE" ] && [ -f "$APPIMAGE_FILE" ]; then
gh release upload ${{ github.ref_name }} "$APPIMAGE_FILE#BenchMesh-${{ needs.get-version.outputs.version }}-Linux-x86_64.AppImage"
else
echo "Warning: AppImage file not found"
fi
if [ -n "$DEB_FILE" ] && [ -f "$DEB_FILE" ]; then
gh release upload ${{ github.ref_name }} "$DEB_FILE#BenchMesh-${{ needs.get-version.outputs.version }}-amd64.deb"
else
echo "Warning: DEB file not found"
fi
build-windows:
needs: [create-release, get-version]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Node dependencies
run: |
npm install
cd benchmesh-serial-service/frontend
npm ci
cd ../..
- name: Ensure .node-red directory exists
run: |
mkdir -p .node-red
echo '{}' > .node-red/.config.nodes.json
echo '{}' > .node-red/.config.runtime.json
shell: bash
- name: Build frontend
run: |
cd benchmesh-serial-service/frontend
npm run build
cd ../..
- name: Install Electron dependencies
run: |
cd electron
npm install
- name: Update version in electron package.json
shell: bash
run: |
cd electron
CURRENT_VERSION=$(node -p "require('./package.json').version")
TARGET_VERSION="${{ needs.get-version.outputs.version }}"
if [ "$CURRENT_VERSION" != "$TARGET_VERSION" ]; then
npm version $TARGET_VERSION --no-git-tag-version --allow-same-version
else
echo "Version already set to $TARGET_VERSION, skipping"
fi
- name: Build Electron app (Windows)
run: |
cd electron
npm run build:win
- name: List built files
shell: bash
run: |
echo "Contents of dist directory:"
ls -la dist/
- name: Upload Windows Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# Find the actual installer and portable EXE files
SETUP_FILE=$(find ./dist -name "*Setup*.exe" -type f | head -1)
PORTABLE_FILE=$(find ./dist -name "*.exe" -type f | grep -v "Setup" | head -1)
if [ -n "$SETUP_FILE" ] && [ -f "$SETUP_FILE" ]; then
gh release upload ${{ github.ref_name }} "$SETUP_FILE#BenchMesh-Setup-${{ needs.get-version.outputs.version }}.exe"
else
echo "Warning: Setup EXE file not found"
fi
if [ -n "$PORTABLE_FILE" ] && [ -f "$PORTABLE_FILE" ]; then
gh release upload ${{ github.ref_name }} "$PORTABLE_FILE#BenchMesh-Portable-${{ needs.get-version.outputs.version }}.exe"
else
echo "Warning: Portable EXE file not found"
fi
build-macos:
needs: [create-release, get-version]
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Node dependencies
run: |
npm install
cd benchmesh-serial-service/frontend
npm ci
cd ../..
- name: Ensure .node-red directory exists
run: |
mkdir -p .node-red
echo '{}' > .node-red/.config.nodes.json
echo '{}' > .node-red/.config.runtime.json
- name: Build frontend
run: |
cd benchmesh-serial-service/frontend
npm run build
cd ../..
- name: Install Electron dependencies
run: |
cd electron
npm install
- name: Update version in electron package.json
run: |
cd electron
CURRENT_VERSION=$(node -p "require('./package.json').version")
TARGET_VERSION="${{ needs.get-version.outputs.version }}"
if [ "$CURRENT_VERSION" != "$TARGET_VERSION" ]; then
npm version $TARGET_VERSION --no-git-tag-version --allow-same-version
else
echo "Version already set to $TARGET_VERSION, skipping"
fi
- name: Build Electron app (macOS)
run: |
cd electron
npm run build:mac
- name: List built files
run: |
echo "Contents of dist directory:"
ls -la dist/
- name: Upload macOS Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Find the actual DMG and ZIP files created
DMG_FILE=$(find ./dist -name "*.dmg" -type f | head -1)
ZIP_FILE=$(find ./dist -name "*-mac.zip" -type f | head -1)
if [ -n "$DMG_FILE" ] && [ -f "$DMG_FILE" ]; then
gh release upload ${{ github.ref_name }} "$DMG_FILE#BenchMesh-${{ needs.get-version.outputs.version }}-macOS.dmg"
else
echo "Warning: DMG file not found"
fi
if [ -n "$ZIP_FILE" ] && [ -f "$ZIP_FILE" ]; then
gh release upload ${{ github.ref_name }} "$ZIP_FILE#BenchMesh-${{ needs.get-version.outputs.version }}-macOS.zip"
else
echo "Warning: ZIP file not found"
fi
build-self-hosted:
needs: [create-release, get-version]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Node dependencies
run: npm install
- name: Build frontend
run: |
cd benchmesh-serial-service/frontend
npm ci
npm run build
cd ../..
- name: Create self-hosted archive
run: |
# Create distribution directory
mkdir -p dist-web/benchmesh
# Copy necessary files
cp -r benchmesh-serial-service dist-web/benchmesh/
# Copy .node-red if it exists (created on first run)
if [ -d .node-red ]; then
cp -r .node-red dist-web/benchmesh/
fi
cp start.sh dist-web/benchmesh/
cp package.json dist-web/benchmesh/
cp package-lock.json dist-web/benchmesh/
cp README.md dist-web/benchmesh/
cp STARTUP.md dist-web/benchmesh/
cp DISTRIBUTION.md dist-web/benchmesh/
# Create installation script
cat > dist-web/benchmesh/install.sh << 'EOF'
#!/bin/bash
echo "Installing BenchMesh dependencies..."
npm install
cd benchmesh-serial-service
pip3 install -r requirements.txt
cd ..
echo ""
echo "Installation complete!"
echo "Run ./start.sh to start BenchMesh"
EOF
chmod +x dist-web/benchmesh/install.sh
# Create archive
cd dist-web
tar -czf benchmesh-web-${{ needs.get-version.outputs.version }}.tar.gz benchmesh/
cd ..
- name: Create checksums
run: |
cd dist-web
sha256sum benchmesh-web-${{ needs.get-version.outputs.version }}.tar.gz > checksums.txt
- name: Upload self-hosted assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} \
./dist-web/benchmesh-web-${{ needs.get-version.outputs.version }}.tar.gz \
./dist-web/checksums.txt#checksums-web.txt