diff --git a/.github/workflows/build-flumi.yml b/.github/workflows/build-flumi.yml new file mode 100644 index 0000000..8645310 --- /dev/null +++ b/.github/workflows/build-flumi.yml @@ -0,0 +1,150 @@ +name: Build Flumi + +on: + push: + paths: + - 'flumi/**' + - '.github/workflows/build-flumi.yml' + pull_request: + paths: + - 'flumi/**' + - '.github/workflows/build-flumi.yml' + workflow_dispatch: + inputs: + use_latest_gdextension: + description: 'Use latest GDExtension artifacts from main branch' + required: false + default: 'false' + type: boolean + +jobs: + build-flumi: + name: Build Flumi + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + platform: linux + godot-version: "4.4.1" + export-preset: "Linux" + - os: windows-latest + platform: windows + godot-version: "4.4.1" + export-preset: "Windows Desktop" + + steps: + - uses: actions/checkout@v4 + + - name: Download GDExtension artifacts (if available) + if: github.event.inputs.use_latest_gdextension == 'true' + uses: dawidd6/action-download-artifact@v6 + with: + workflow: build-gdextension.yml + name: gdextension-${{ matrix.platform }} + path: gdextension-artifacts + if_no_artifact_found: warn + branch: main + continue-on-error: true + + - name: Cache Godot installation + uses: actions/cache@v4 + with: + path: | + ~/.local/share/godot + ~/AppData/Roaming/Godot + key: ${{ runner.os }}-godot-${{ matrix.godot-version }} + + - name: Setup Godot + uses: chickensoft-games/setup-godot@v2.3.0 + with: + version: ${{ matrix.godot-version }} + include-templates: true + + - name: Prepare GDExtension addon (if artifacts available) + if: hashFiles('gdextension-artifacts/*') != '' + shell: bash + run: | + mkdir -p flumi/addons/gurt-protocol/bin/${{ matrix.platform }} + + # Copy GDExtension files + cp gdextension-artifacts/gurt_godot.gdextension flumi/addons/gurt-protocol/ + cp gdextension-artifacts/plugin.cfg flumi/addons/gurt-protocol/ + cp gdextension-artifacts/plugin.gd flumi/addons/gurt-protocol/ + + # Copy the built library + case "${{ matrix.platform }}" in + windows) + cp gdextension-artifacts/gurt_godot.dll flumi/addons/gurt-protocol/bin/${{ matrix.platform }}/ + ;; + linux) + cp gdextension-artifacts/libgurt_godot.so flumi/addons/gurt-protocol/bin/${{ matrix.platform }}/ + ;; + esac + + - name: Cache Godot import files + uses: actions/cache@v4 + with: + path: | + flumi/.godot/ + key: ${{ runner.os }}-flumi-import-${{ hashFiles('flumi/**/*.tscn', 'flumi/**/*.tres', 'flumi/**/*.gd') }} + restore-keys: | + ${{ runner.os }}-flumi-import- + + - name: Import Godot project + run: | + cd flumi + godot --headless --import + + - name: Verify export presets + shell: bash + run: | + cd flumi + echo "Available export presets:" + if [ -f export_presets.cfg ]; then + grep -E '^\[preset\.' export_presets.cfg || echo "No presets found in config" + else + echo "export_presets.cfg not found" + fi + + - name: Export Flumi + shell: bash + run: | + cd flumi + mkdir -p ../flumi-builds/${{ matrix.platform }} + + case "${{ matrix.platform }}" in + windows) + echo "Exporting for Windows..." + godot --headless --export-release "${{ matrix.export-preset }}" ../flumi-builds/${{ matrix.platform }}/Flumi.exe --verbose || { + echo "Export failed with exit code $?" + echo "Trying without --verbose flag..." + godot --headless --export-release "${{ matrix.export-preset }}" ../flumi-builds/${{ matrix.platform }}/Flumi.exe + } + ;; + linux) + echo "Exporting for Linux..." + godot --headless --export-release "${{ matrix.export-preset }}" ../flumi-builds/${{ matrix.platform }}/Flumi --verbose || { + echo "Export failed with exit code $?" + echo "Trying without --verbose flag..." + godot --headless --export-release "${{ matrix.export-preset }}" ../flumi-builds/${{ matrix.platform }}/Flumi + } + ;; + esac + + # Verify the export was successful + if [ -f "../flumi-builds/${{ matrix.platform }}/Flumi${{ matrix.platform == 'windows' && '.exe' || '' }}" ]; then + echo "Export successful!" + ls -la ../flumi-builds/${{ matrix.platform }}/ + else + echo "Export failed - no output file found" + exit 1 + fi + + - name: Upload Flumi artifacts + uses: actions/upload-artifact@v4 + with: + name: flumi-${{ matrix.platform }} + path: flumi-builds/${{ matrix.platform }} + retention-days: 30 diff --git a/.github/workflows/build-gdextension.yml b/.github/workflows/build-gdextension.yml new file mode 100644 index 0000000..8785d6e --- /dev/null +++ b/.github/workflows/build-gdextension.yml @@ -0,0 +1,78 @@ +name: Build GDExtension + +on: + push: + paths: + - 'protocol/gdextension/**' + - 'protocol/library/**' + - '.github/workflows/build-gdextension.yml' + pull_request: + paths: + - 'protocol/gdextension/**' + - 'protocol/library/**' + - '.github/workflows/build-gdextension.yml' + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + build-gdextension: + name: Build GDExtension + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + platform: linux + lib_name: libgurt_godot.so + - os: windows-latest + target: x86_64-pc-windows-msvc + platform: windows + lib_name: gurt_godot.dll + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Cache cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + protocol/target/ + key: ${{ runner.os }}-gdextension-${{ hashFiles('protocol/gdextension/Cargo.lock', 'protocol/library/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-gdextension- + ${{ runner.os }}-cargo- + + - name: Build GDExtension + run: | + cd protocol/gdextension + cargo build --release --target ${{ matrix.target }} + + - name: Prepare artifacts + shell: bash + run: | + mkdir -p artifacts/${{ matrix.platform }} + cp protocol/gdextension/target/${{ matrix.target }}/release/${{ matrix.lib_name }} artifacts/${{ matrix.platform }}/ + + # Also copy the extension configuration files + cp protocol/gdextension/gurt_godot.gdextension artifacts/${{ matrix.platform }}/ + cp protocol/gdextension/plugin.cfg artifacts/${{ matrix.platform }}/ + cp protocol/gdextension/plugin.gd artifacts/${{ matrix.platform }}/ + + - name: Upload GDExtension artifacts + uses: actions/upload-artifact@v4 + with: + name: gdextension-${{ matrix.platform }} + path: artifacts/${{ matrix.platform }} + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/build-gurtca.yml b/.github/workflows/build-gurtca.yml new file mode 100644 index 0000000..b1749c7 --- /dev/null +++ b/.github/workflows/build-gurtca.yml @@ -0,0 +1,124 @@ +name: Build GurtCA + +on: + push: + paths: + - 'protocol/gurtca/**' + - 'protocol/library/**' + - '.github/workflows/build-gurtca.yml' + pull_request: + paths: + - 'protocol/gurtca/**' + - 'protocol/library/**' + - '.github/workflows/build-gurtca.yml' + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + build-gurtca: + name: Build GurtCA + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + platform: linux + ext: "" + - os: windows-latest + target: x86_64-pc-windows-msvc + platform: windows + ext: ".exe" + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Cache cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + protocol/target/ + key: ${{ runner.os }}-gurtca-${{ hashFiles('protocol/gurtca/Cargo.lock', 'protocol/library/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-gurtca- + ${{ runner.os }}-cargo- + + - name: Install OpenSSL (Ubuntu) + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y pkg-config libssl-dev + + - name: Cache vcpkg and OpenSSL (Windows) + if: matrix.os == 'windows-latest' + uses: actions/cache@v4 + with: + path: | + C:\vcpkg + C:\vcpkg\installed\x64-windows-static-md + key: ${{ runner.os }}-vcpkg-openssl-${{ hashFiles('.github/workflows/build-gurtca.yml') }} + restore-keys: | + ${{ runner.os }}-vcpkg-openssl- + ${{ runner.os }}-vcpkg- + + - name: Install OpenSSL (Windows) + if: matrix.os == 'windows-latest' + run: | + if (!(Test-Path "C:\vcpkg")) { + Write-Host "Installing vcpkg..." + git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg + cd C:\vcpkg + .\bootstrap-vcpkg.bat + .\vcpkg.exe integrate install + } + + # Check if OpenSSL is properly installed + $opensslInstalled = (Test-Path "C:\vcpkg\installed\x64-windows-static-md\lib\libssl.lib") -and + (Test-Path "C:\vcpkg\installed\x64-windows-static-md\lib\libcrypto.lib") -and + (Test-Path "C:\vcpkg\installed\x64-windows-static-md\include\openssl\opensslv.h") + + if ($opensslInstalled) { + Write-Host "OpenSSL already installed, skipping..." + } else { + Write-Host "Installing OpenSSL..." + cd C:\vcpkg + .\vcpkg.exe install openssl:x64-windows-static-md + } + shell: pwsh + + - name: Set OpenSSL environment variables (Windows) + if: matrix.os == 'windows-latest' + shell: pwsh + run: | + echo "VCPKG_ROOT=C:\vcpkg" >> $env:GITHUB_ENV + echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $env:GITHUB_ENV + + - name: Build GurtCA + run: | + cd protocol/gurtca + cargo build --release --target ${{ matrix.target }} + + - name: Prepare artifacts + shell: bash + run: | + mkdir -p artifacts/${{ matrix.platform }} + cp protocol/gurtca/target/${{ matrix.target }}/release/gurtca${{ matrix.ext }} artifacts/${{ matrix.platform }}/ + + - name: Upload GurtCA artifacts + uses: actions/upload-artifact@v4 + with: + name: gurtca-${{ matrix.platform }} + path: artifacts/${{ matrix.platform }} + retention-days: 30 + diff --git a/.github/workflows/build-gurty.yml b/.github/workflows/build-gurty.yml new file mode 100644 index 0000000..532cfc3 --- /dev/null +++ b/.github/workflows/build-gurty.yml @@ -0,0 +1,73 @@ +name: Build Gurty + +on: + push: + paths: + - 'protocol/cli/**' + - 'protocol/library/**' + - '.github/workflows/build-gurty.yml' + pull_request: + paths: + - 'protocol/cli/**' + - 'protocol/library/**' + - '.github/workflows/build-gurty.yml' + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + build-gurty: + name: Build Gurty + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + platform: linux + ext: "" + - os: windows-latest + target: x86_64-pc-windows-msvc + platform: windows + ext: ".exe" + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Cache cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + protocol/target/ + key: ${{ runner.os }}-gurty-${{ hashFiles('protocol/cli/Cargo.lock', 'protocol/library/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-gurty- + ${{ runner.os }}-cargo- + + - name: Build Gurty + run: | + cd protocol/cli + cargo build --release --target ${{ matrix.target }} + + - name: Prepare artifacts + shell: bash + run: | + mkdir -p artifacts/${{ matrix.platform }} + cp protocol/cli/target/${{ matrix.target }}/release/gurty${{ matrix.ext }} artifacts/${{ matrix.platform }}/ + + - name: Upload Gurty artifacts + uses: actions/upload-artifact@v4 + with: + name: gurty-${{ matrix.platform }} + path: artifacts/${{ matrix.platform }} + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml new file mode 100644 index 0000000..f5eb7d1 --- /dev/null +++ b/.github/workflows/package-release.yml @@ -0,0 +1,255 @@ +name: Package Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + inputs: + tag: + description: 'Release tag' + required: true + default: 'v1.0.3' + download_artifacts: + description: 'Download latest artifacts from main branch' + required: false + default: 'true' + type: boolean + +jobs: + package-release: + name: Package Release + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Download GurtCA artifacts + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + uses: dawidd6/action-download-artifact@v6 + with: + workflow: build-gurtca.yml + name_is_regexp: true + name: gurtca-.* + path: artifacts/ + if_no_artifact_found: warn + branch: main + continue-on-error: true + + - name: Download Gurty artifacts + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + uses: dawidd6/action-download-artifact@v6 + with: + workflow: build-gurty.yml + name_is_regexp: true + name: gurty-.* + path: artifacts/ + if_no_artifact_found: warn + branch: main + continue-on-error: true + + - name: Download GDExtension artifacts + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + uses: dawidd6/action-download-artifact@v6 + with: + workflow: build-gdextension.yml + name_is_regexp: true + name: gdextension-.* + path: artifacts/ + if_no_artifact_found: warn + branch: main + continue-on-error: true + + - name: Download Flumi artifacts + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + uses: dawidd6/action-download-artifact@v6 + with: + workflow: build-flumi.yml + name_is_regexp: true + name: flumi-.* + path: artifacts/ + if_no_artifact_found: warn + branch: main + continue-on-error: true + + - name: List downloaded artifacts + shell: powershell + run: | + Write-Output "Downloaded artifacts:" + Get-ChildItem -Path artifacts -Recurse -File | Sort-Object FullName + + - name: Download and setup UPX + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + shell: powershell + run: | + Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip" -OutFile "upx.zip" + Expand-Archive -Path "upx.zip" -DestinationPath "." + + - name: Compress Windows Flumi binaries with UPX + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + shell: powershell + run: | + if (Test-Path "artifacts/flumi-windows") { + Write-Output "Compressing Windows Flumi binaries..." + + # Create build-scripts/Windows structure + New-Item -ItemType Directory -Path "build-scripts/Windows" -Force + Copy-Item "artifacts/flumi-windows/*" "build-scripts/Windows/" -Force + + # Run UPX compression + try { + & ".\upx-4.2.4-win64\upx.exe" --lzma --best build-scripts/Windows/*.exe build-scripts/Windows/*.dll + Write-Output "UPX compression completed successfully" + } catch { + Write-Output "UPX compression completed with warnings: $($_.Exception.Message)" + } + + # Copy compressed files back + Copy-Item "build-scripts/Windows/*" "artifacts/flumi-windows/" -Force + } + + - name: Download and setup Inno Setup + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + shell: powershell + run: | + Invoke-WebRequest -Uri "https://files.jrsoftware.org/is/6/innosetup-6.5.3.exe" -OutFile "innosetup.exe" + Start-Process -FilePath ".\innosetup.exe" -ArgumentList "/VERYSILENT", "/NORESTART", "/DIR=C:\InnoSetup" -Wait + + - name: Build Windows installer + if: github.event.inputs.download_artifacts == 'true' || github.event_name == 'push' + shell: powershell + run: | + if (Test-Path "artifacts\flumi-windows") { + Write-Output "Building Windows installer..." + + # Ensure the path relative to the .iss exists + New-Item -ItemType Directory -Path "flumi\build-scripts\Windows" -Force | Out-Null + + # Copy files from artifacts into flumi\build-scripts\Windows (robust enumeration) + Get-ChildItem -Path "artifacts\flumi-windows" -File | ForEach-Object { + Copy-Item -Path $_.FullName -Destination "flumi\build-scripts\Windows" -Force + } + + # Ensure installer output dir matches OutputDir=Windows\installer in .iss + New-Item -ItemType Directory -Path "flumi\build-scripts\Windows\installer" -Force | Out-Null + + # Compile using .iss (paths resolved relative to flumi/build-scripts) + $issPath = Resolve-Path "flumi\build-scripts\flumi-installer.iss" + & "C:\InnoSetup\ISCC.exe" $issPath.Path + + # Copy installer to artifacts + $built = Get-ChildItem "flumi\build-scripts\Windows\installer" -Filter "Flumi-Setup-*.exe" -ErrorAction SilentlyContinue + if ($built) { + Copy-Item $built.FullName "artifacts\flumi-windows" -Force + Write-Output "Installer created and copied successfully" + } else { + Write-Output "Warning: Installer was not created" + } + } + - name: Prepare release assets + shell: powershell + run: | + New-Item -ItemType Directory -Path "release-assets" -Force + + # Package Rust binaries (GurtCA + Gurty) + foreach ($platform in @("linux", "windows")) { + $tempDir = "temp-tools-$platform" + New-Item -ItemType Directory -Path $tempDir -Force + + # Copy GurtCA if available + if (Test-Path "artifacts/gurtca-$platform") { + Copy-Item "artifacts/gurtca-$platform/*" $tempDir -Force + } + + # Copy Gurty if available + if (Test-Path "artifacts/gurty-$platform") { + Copy-Item "artifacts/gurty-$platform/*" $tempDir -Force + } + + # Package if we have any files + $files = Get-ChildItem $tempDir -ErrorAction SilentlyContinue + if ($files.Count -gt 0) { + if ($platform -eq "windows") { + Compress-Archive -Path "$tempDir/*" -DestinationPath "release-assets/gurted-tools-$platform.zip" -Force + } else { + # For Linux files, we'll use 7zip if available, otherwise skip tar.gz creation on Windows + if (Get-Command "7z" -ErrorAction SilentlyContinue) { + & "7z" a -ttar "release-assets/gurted-tools-$platform.tar" "$tempDir/*" + & "7z" a -tgzip "release-assets/gurted-tools-$platform.tar.gz" "release-assets/gurted-tools-$platform.tar" + Remove-Item "release-assets/gurted-tools-$platform.tar" -Force + } else { + # Fallback to zip for Linux binaries too + Compress-Archive -Path "$tempDir/*" -DestinationPath "release-assets/gurted-tools-$platform.zip" -Force + } + } + } + + Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue + } + + # Package Flumi builds + foreach ($platform in @("linux", "windows")) { + if (Test-Path "artifacts/flumi-$platform") { + Push-Location "artifacts/flumi-$platform" + + if ($platform -eq "windows") { + + # Copy installer separately if it exists + $installer = Get-ChildItem "Flumi-Setup-*.exe" -ErrorAction SilentlyContinue + if ($installer) { + Copy-Item $installer "../../release-assets/" -Force + } + } else { + if (Get-Command "7z" -ErrorAction SilentlyContinue) { + & "7z" a -ttar "../../release-assets/flumi-$platform.tar" "*" + & "7z" a -tgzip "../../release-assets/flumi-$platform.tar.gz" "../../release-assets/flumi-$platform.tar" + Remove-Item "../../release-assets/flumi-$platform.tar" -Force + } else { + Compress-Archive -Path "*" -DestinationPath "../../release-assets/flumi-$platform.zip" -Force + } + } + Pop-Location + } + } + + + - name: Get release tag + id: get_tag + shell: powershell + run: | + if ("${{ github.event_name }}" -eq "workflow_dispatch") { + echo "tag=${{ github.event.inputs.tag }}" >> $env:GITHUB_OUTPUT + } else { + $tag = "${{ github.ref }}" -replace "refs/tags/", "" + echo "tag=$tag" >> $env:GITHUB_OUTPUT + } + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.get_tag.outputs.tag }} + name: Gurted ${{ steps.get_tag.outputs.tag }} + body: | + ## Gurted Release ${{ steps.get_tag.outputs.tag }} + + This release includes: + - **GurtCA**: CLI tool for obtaining TLS certificates + - **Gurty**: CLI tool for managing GURT protocol servers + - **Flumi**: The official browser for the GURT ecosystem + + ### Downloads + - `gurted-tools-*.zip`: Contains GurtCA and Gurty binaries + - `flumi-linux.*`: Contains the Flumi wayfinder application for Linux + - `Flumi-Setup-*.exe`: Windows installer for Flumi (recommended for Windows users) + + ### Platform Support + - Linux (x86_64) + - Windows (x86_64) + + For documentation and usage instructions, visit [docs.gurted.com](https://docs.gurted.com) + files: release-assets/* + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +