Skip to content

fix: resolve duplicate PATH environment variable in Rust compiler #40

fix: resolve duplicate PATH environment variable in Rust compiler

fix: resolve duplicate PATH environment variable in Rust compiler #40

Workflow file for this run

name: build-desktop

Check failure on line 1 in .github/workflows/build-desktop.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-desktop.yml

Invalid workflow file

(Line: 113, Col: 1): 'name' is already defined, (Line: 115, Col: 1): 'on' is already defined, (Line: 144, Col: 1): 'jobs' is already defined
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
macos:
name: Build macOS DMG
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache: true
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Determine version
id: ver
shell: bash
run: |
ref="${GITHUB_REF_NAME}"
ver="${ref#v}"
if [[ -z "$ver" ]]; then ver="1.0.0"; fi
echo "VERSION=$ver" >> "$GITHUB_ENV"
echo "version=$ver" >> "$GITHUB_OUTPUT"
- name: Build macOS DMG
env:
VERSION: ${{ env.VERSION }}
run: |
chmod +x scripts/package-macos.sh
./scripts/package-macos.sh
- name: Upload DMG artifact
uses: actions/upload-artifact@v4
with:
name: macos-dmg
path: dist/*.dmg
- name: Upload DMG to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: dist/*.dmg
repository: cherrypick-agency/flutter_network_debugger
tag_name: ${{ github.ref_name }}
token: ${{ secrets.RELEASE_TOKEN }}
# Временно отключено: сборка MSI нестабильна, вернём позже
windows:
name: Build Windows MSI
runs-on: windows-latest
if: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache: true
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install WiX Toolset
run: choco install wixtoolset -y
shell: powershell
- name: Determine version
id: ver
shell: bash
run: |
ref="${GITHUB_REF_NAME}"
ver="${ref#v}"
if [[ -z "$ver" ]]; then ver="1.0.0"; fi
echo "VERSION=$ver" >> "$GITHUB_ENV"
echo "version=$ver" >> "$GITHUB_OUTPUT"
- name: Build Windows MSI
run: |
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\package-windows-msi.ps1 -Version "${{ env.VERSION }}"
- name: Upload MSI artifact
uses: actions/upload-artifact@v4
with:
name: windows-msi
path: dist\*.msi
- name: Upload MSI to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: dist/*.msi
repository: cherrypick-agency/flutter_network_debugger
tag_name: ${{ github.ref_name }}
token: ${{ secrets.RELEASE_TOKEN }}
name: Desktop Builds
on:
push:
branches: [ main ]
tags:
- 'v*.*.*'
paths:
- 'frontend/**'
- 'cmd/network-debugger/**'
- 'internal/**'
- 'scripts/package-*.sh'
- 'scripts/package-*.ps1'
- '.github/workflows/build-desktop.yml'
pull_request:
paths:
- 'frontend/**'
- 'cmd/network-debugger/**'
- 'internal/**'
- 'scripts/package-*.sh'
- 'scripts/package-*.ps1'
- '.github/workflows/build-desktop.yml'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-macos:
runs-on: macos-latest
strategy:
matrix:
arch: [x86_64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
- name: Install create-dmg
run: brew install create-dmg
- name: Cache Flutter dependencies
uses: actions/cache@v4
with:
path: |
~/.pub-cache
frontend/.dart_tool
key: ${{ runner.os }}-flutter-${{ hashFiles('frontend/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-flutter-
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Flutter pub get
working-directory: frontend
run: flutter pub get
- name: Enable macOS desktop
working-directory: frontend
run: |
flutter config --enable-macos-desktop
flutter create --platforms=macos .
- name: Set version
id: version
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
else
echo "VERSION=dev-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
fi
- name: Build macOS DMG
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
# Override architecture for cross-compilation if needed
if [ "${{ matrix.arch }}" = "x86_64" ] && [ "$(uname -m)" != "x86_64" ]; then
echo "Cross-compiling for x86_64 on arm64 host"
# Build Go binary for x86_64
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" \
-o dist/server_darwin_amd64 ./cmd/network-debugger
# Flutter currently doesn't support cross-compilation for macOS
# So we skip x86_64 builds on arm64 runners
echo "Skipping x86_64 Flutter build on arm64 runner"
exit 0
elif [ "${{ matrix.arch }}" = "arm64" ] && [ "$(uname -m)" != "arm64" ]; then
echo "Cannot cross-compile arm64 on x86_64 runner"
exit 0
fi
chmod +x scripts/package-macos.sh
./scripts/package-macos.sh
- name: Upload DMG artifact
if: matrix.arch == runner.arch || matrix.arch == 'arm64' && runner.arch == 'ARM64'
uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.arch }}-dmg
path: dist/*.dmg
retention-days: 7
# Временно отключили windows-сборку
build-windows:
runs-on: windows-latest
if: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
- name: Cache Flutter dependencies
uses: actions/cache@v4
with:
path: |
~\AppData\Local\Pub\Cache
frontend\.dart_tool
key: ${{ runner.os }}-flutter-${{ hashFiles('frontend/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-flutter-
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~\go\pkg\mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Flutter pub get
working-directory: frontend
run: flutter pub get
- name: Enable Windows desktop
working-directory: frontend
run: |
flutter config --enable-windows-desktop
flutter create --platforms=windows .
- name: Set version
id: version
shell: bash
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
else
echo "VERSION=dev-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
fi
- name: Build Windows ZIP
shell: pwsh
run: |
$env:VERSION = "${{ steps.version.outputs.VERSION }}"
./scripts/package-windows.ps1 -Version $env:VERSION
- name: Upload ZIP artifact
uses: actions/upload-artifact@v4
with:
name: windows-amd64-zip
path: dist/*.zip
retention-days: 7
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang cmake ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev libsecret-1-dev
- name: Cache Flutter dependencies
uses: actions/cache@v4
with:
path: |
~/.pub-cache
frontend/.dart_tool
key: ${{ runner.os }}-flutter-${{ hashFiles('frontend/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-flutter-
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Flutter pub get
working-directory: frontend
run: flutter pub get
- name: Enable Linux desktop
working-directory: frontend
run: |
flutter config --enable-linux-desktop
flutter create --platforms=linux .
- name: Set version
id: version
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
else
echo "VERSION=dev-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
fi
- name: Build Linux packages
env:
VERSION: ${{ steps.version.outputs.VERSION }}
ARCH: ${{ matrix.arch }}
run: |
chmod +x scripts/package-linux.sh
./scripts/package-linux.sh
- name: Upload tar.gz artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch }}-tar
path: dist/*.tar.gz
retention-days: 7
- name: Upload deb artifact
uses: actions/upload-artifact@v4
if: hashFiles('dist/*.deb') != ''
with:
name: linux-${{ matrix.arch }}-deb
path: dist/*.deb
retention-days: 7
# Release job - only runs on version tags
release:
needs: [build-macos, build-linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release
find artifacts -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.tar.gz" -o -name "*.deb" \) -exec cp {} release/ \;
ls -lah release/
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
run: |
echo "## What's Changed" > CHANGELOG.md
echo "" >> CHANGELOG.md
git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty=format:"- %s (%h)" >> CHANGELOG.md || echo "- Initial release" >> CHANGELOG.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release/*
body_path: CHANGELOG.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Summary job
summary:
needs: [build-macos, build-linux]
runs-on: ubuntu-latest
if: always()
steps:
- name: Build Summary
run: |
echo "## Desktop Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Platform | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| macOS | ${{ needs.build-macos.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Linux | ${{ needs.build-linux.result }} |" >> $GITHUB_STEP_SUMMARY