mirror of
https://github.com/beekeeper-studio/beekeeper-studio.git
synced 2026-03-13 10:12:54 +08:00
# Conflicts: # .github/workflows/studio-build-non-production.yml # .github/workflows/studio-publish.yml
187 lines
6.1 KiB
YAML
187 lines
6.1 KiB
YAML
name: Studio - Build [non production]
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: write
|
|
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- apps/sqltools/**
|
|
- docs/**
|
|
push:
|
|
branches:
|
|
- "master"
|
|
paths-ignore:
|
|
- 'apps/sqltools/**'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
masterbuild:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [macos-14, ubuntu-22.04, windows-2022, ubuntu-22.04-arm]
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install Snapcraft
|
|
uses: samuelmeuli/action-snapcraft@v2
|
|
if: "contains(matrix.os, 'ubuntu')"
|
|
|
|
- name: Install python 3.11 (not Mac)
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.11
|
|
if: "!startsWith(matrix.os, 'macos')"
|
|
|
|
|
|
- name: Install flatpak tools
|
|
if: "contains(matrix.os, 'ubuntu')"
|
|
run: |
|
|
sudo apt install -y flatpak flatpak-builder rpm
|
|
flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
|
|
|
- name: Install fpm
|
|
run: sudo gem install fpm -v 1.17.0
|
|
if: "contains(matrix.os, 'ubuntu')"
|
|
|
|
- name: Install python 3.11 (mac)
|
|
if: "startsWith(matrix.os, 'macos')"
|
|
run: |
|
|
# Install Python 3.11
|
|
brew install python@3.11
|
|
# Add Python 3.11 to PATH
|
|
echo "/opt/homebrew/opt/python@3.11/libexec/bin" >> $GITHUB_PATH
|
|
export PATH="/opt/homebrew/opt/python@3.11/libexec/bin:$PATH"
|
|
export PYTHON_PATH="/opt/homebrew/opt/python@3.11/libexec/bin/python3"
|
|
|
|
- name: Verify Python Version
|
|
if: "startsWith(matrix.os, 'windows')"
|
|
run: |
|
|
$PYTHON_VERSION = python --version | Out-String
|
|
Write-Output "Installed Python version: $PYTHON_VERSION"
|
|
if (-not $PYTHON_VERSION.StartsWith("Python 3.11")) {
|
|
Write-Output "Error: Python version does not start with 3.11"
|
|
exit 1
|
|
}
|
|
shell: powershell
|
|
|
|
- name: Verify Python Version
|
|
if: "!startsWith(matrix.os, 'windows')"
|
|
run: |
|
|
PYTHON_VERSION=$(python3 --version | cut -d " " -f 2)
|
|
echo "Installed Python version: $PYTHON_VERSION"
|
|
if [[ ! $PYTHON_VERSION == 3.11* ]]; then
|
|
echo "Error: Python version does not start with 3.11"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Install Node.js, NPM and Yarn
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Cache node_modules
|
|
id: cache-nm
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
apps/studio/node_modules
|
|
apps/ui-kit/node_modules
|
|
apps/sqltools/node_modules
|
|
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Clean cache
|
|
if: steps.cache-nm.outputs.cache-hit != 'true'
|
|
run: yarn cache clean
|
|
|
|
- name: Check dependencies
|
|
if: steps.cache-nm.outputs.cache-hit != 'true'
|
|
run: "yarn install --frozen-lockfile --network-timeout 100000"
|
|
env:
|
|
npm_config_node_gyp: ${{ github.workspace }}${{ runner.os == 'Windows' && '\node_modules\node-gyp\bin\node-gyp.js' || '/node_modules/node-gyp/bin/node-gyp.js' }}
|
|
- name: Build Electron app
|
|
run: "yarn run electron:build --publish never"
|
|
if: startsWith(matrix.os, 'ubuntu') == false
|
|
env:
|
|
PYTHON_PATH: "${{ startsWith(matrix.os, 'macos') && '/opt/homebrew/opt/python@3.11/libexec/bin/python3' || '$PYTHON_PATH' }}"
|
|
PYTHONPATH: "${{ startsWith(matrix.os, 'macos') && '/opt/homebrew/opt/python@3.11/libexec/bin/python3' || '$PYTHONPATH' }}"
|
|
SNAPCRAFT_BUILD_ENVIRONMENT: 'lxd'
|
|
USE_SYSTEM_FPM: true
|
|
|
|
# Build deb for hardlinks testing
|
|
- name: Build Electron app
|
|
run: yarn run electron:build --publish never --linux deb
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
env:
|
|
PYTHON_PATH: "${{ startsWith(matrix.os, 'macos') && '/opt/homebrew/opt/python@3.11/libexec/bin/python3' || '$PYTHON_PATH' }}"
|
|
PYTHONPATH: "${{ startsWith(matrix.os, 'macos') && '/opt/homebrew/opt/python@3.11/libexec/bin/python3' || '$PYTHONPATH' }}"
|
|
SNAPCRAFT_BUILD_ENVIRONMENT: 'lxd'
|
|
USE_SYSTEM_FPM: true
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.os }}
|
|
path: |
|
|
apps/studio/dist_electron/*.exe
|
|
apps/studio/dist_electron/*.deb
|
|
apps/studio/dist_electron/*.rpm
|
|
apps/studio/dist_electron/*.AppImage
|
|
apps/studio/dist_electron/*.dmg
|
|
apps/studio/dist_electron/*.snap
|
|
apps/studio/dist_electron/*.yml
|
|
|
|
test-deb-hardlinks:
|
|
name: Test DEB on separate filesystems
|
|
runs-on: ubuntu-22.04
|
|
needs: masterbuild
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Download DEB artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ubuntu-22.04
|
|
path: ./deb-package
|
|
|
|
- name: List downloaded files
|
|
run: |
|
|
echo "Contents of deb-package directory:"
|
|
ls -lh ./deb-package/
|
|
|
|
- name: Find DEB file
|
|
id: find_deb
|
|
run: |
|
|
DEB_FILE=$(find ./deb-package -name "*.deb" | head -n 1)
|
|
if [ -z "$DEB_FILE" ]; then
|
|
echo "ERROR: No .deb file found in artifact"
|
|
exit 1
|
|
fi
|
|
echo "deb_file=$DEB_FILE" >> $GITHUB_OUTPUT
|
|
echo "Found DEB file: $DEB_FILE"
|
|
|
|
- name: Make test script executable
|
|
run: chmod +x ./bin/test-deb-hardlinks.sh
|
|
|
|
- name: Run hardlinks test
|
|
run: |
|
|
echo "Testing: ${{ steps.find_deb.outputs.deb_file }}"
|
|
./bin/test-deb-hardlinks.sh "${{ steps.find_deb.outputs.deb_file }}"
|
|
|
|
- name: Test result
|
|
if: success()
|
|
run: |
|
|
echo "✓ DEB package successfully installs on separate filesystems"
|
|
echo "✓ No hardlinks regression detected"
|