diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml deleted file mode 100644 index d5f15485..00000000 --- a/.github/workflows/npm-publish.yml +++ /dev/null @@ -1,179 +0,0 @@ -name: Publish npm package - -on: - workflow_dispatch: - inputs: - dry-run: - description: 'Dry run' - required: true - type: boolean - default: true - schedule: - - cron: '48 3 * * 1' # 3:48 AM UTC every Monday - -jobs: - preflight: - name: Preflight - runs-on: ubuntu-latest - outputs: - dry-run: ${{ steps.get-dry-run.outputs.dry-run }} - - steps: - - name: Get dry run - id: get-dry-run - shell: pwsh - run: | - $IsDryRun = '${{ github.event.inputs.dry-run }}' -Eq 'true' -Or '${{ github.event_name }}' -Eq 'schedule' - - if ($IsDryRun) { - echo "dry-run=true" >> $Env:GITHUB_OUTPUT - } else { - echo "dry-run=false" >> $Env:GITHUB_OUTPUT - } - - build: - name: Build package [${{matrix.library}}] - runs-on: ubuntu-latest - needs: - - preflight - - strategy: - fail-fast: false - matrix: - library: - - iron-remote-desktop - - iron-remote-desktop-rdp - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup wasm-pack - shell: bash - run: | - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Install dependencies - shell: pwsh - run: | - Set-Location -Path "./web-client/${{matrix.library}}/" - npm install - - - name: Build package - shell: pwsh - run: | - Set-PSDebug -Trace 1 - - Set-Location -Path "./web-client/${{matrix.library}}/" - npm run build - Set-Location -Path ./dist - npm pack - - - name: Harvest package - shell: pwsh - run: | - Set-PSDebug -Trace 1 - - New-Item -ItemType "directory" -Path . -Name "npm-packages" - Get-ChildItem -Path ./web-client/ -Recurse *.tgz | ForEach { Copy-Item $_ "./npm-packages" } - - - name: Upload package artifact - uses: actions/upload-artifact@v4 - with: - name: npm-${{matrix.library}} - path: npm-packages/*.tgz - - npm-merge: - name: Merge artifacts - runs-on: ubuntu-latest - needs: build - - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@v4 - with: - name: npm - pattern: npm-* - delete-merged: true - - publish: - name: Publish package - runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' - environment: publish - needs: - - preflight - - npm-merge - - steps: - - name: Download NPM packages artifact - uses: actions/download-artifact@v4 - with: - name: npm - path: npm-packages - - - name: Prepare npm - shell: pwsh - run: npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" - - - name: Publish - shell: pwsh - run: | - Set-PSDebug -Trace 1 - - $isDryRun = '${{ needs.preflight.outputs.dry-run }}' -Eq 'true' - - $files = Get-ChildItem -Recurse npm-packages/*.tgz - - foreach ($file in $files) { - Write-Host "Publishing $($File.Name)..." - - $publishCmd = @( - 'npm', - 'publish', - "$File", - '--access=public' - ) - - if ($isDryRun) { - $publishCmd += '--dry-run' - } - - $publishCmd = $publishCmd -Join ' ' - Invoke-Expression $publishCmd - } - - - name: Update Artifactory Cache - run: | - gh workflow run update-artifactory-cache.yml --repo Devolutions/scheduled-tasks --field package_name="iron-remote-desktop" - gh workflow run update-artifactory-cache.yml --repo Devolutions/scheduled-tasks --field package_name="iron-remote-desktop-rdp" - env: - GH_TOKEN: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }} - - notify: - name: Notify failure - runs-on: ubuntu-latest - if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }} - needs: - - preflight - - build - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ARCHITECTURE }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - steps: - - name: Send slack notification - id: slack - uses: slackapi/slack-github-action@v1.26.0 - with: - payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*${{ github.repository }}* :fire::fire::fire::fire::fire: \n The scheduled build for *${{ github.repository }}* is <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|broken>" - } - } - ] - } diff --git a/.github/workflows/nuget-publish.yml b/.github/workflows/nuget-publish.yml deleted file mode 100644 index e76f4e56..00000000 --- a/.github/workflows/nuget-publish.yml +++ /dev/null @@ -1,417 +0,0 @@ -name: Publish NuGet package - -on: - workflow_dispatch: - inputs: - dry-run: - description: 'Dry run' - required: true - type: boolean - default: true - schedule: - - cron: '21 3 * * 1' # 3:21 AM UTC every Monday - -jobs: - preflight: - name: Preflight - runs-on: ubuntu-latest - outputs: - dry-run: ${{ steps.get-dry-run.outputs.dry-run }} - project-version: ${{ steps.get-version.outputs.project-version }} - package-version: ${{ steps.get-version.outputs.package-version }} - - steps: - - name: Checkout ${{ github.repository }} - uses: actions/checkout@v4 - - - name: Get dry run - id: get-dry-run - shell: pwsh - run: | - $IsDryRun = '${{ github.event.inputs.dry-run }}' -Eq 'true' -Or '${{ github.event_name }}' -Eq 'schedule' - - if ($IsDryRun) { - echo "dry-run=true" >> $Env:GITHUB_OUTPUT - } else { - echo "dry-run=false" >> $Env:GITHUB_OUTPUT - } - - - name: Get version - id: get-version - shell: pwsh - run: | - $CsprojXml = [Xml] (Get-Content .\ffi\dotnet\Devolutions.IronRdp\Devolutions.IronRdp.csproj) - $ProjectVersion = $CsprojXml.Project.PropertyGroup.Version | Select-Object -First 1 - $PackageVersion = $ProjectVersion -Replace "^(\d+)\.(\d+)\.(\d+).(\d+)$", "`$1.`$2.`$3" - echo "project-version=$ProjectVersion" >> $Env:GITHUB_OUTPUT - echo "package-version=$PackageVersion" >> $Env:GITHUB_OUTPUT - - build-native: - name: Native build - runs-on: ${{matrix.runner}} - needs: preflight - strategy: - fail-fast: false - matrix: - os: [ win, osx, linux, ios, android ] - arch: [ x86, x64, arm, arm64 ] - include: - - os: win - runner: windows-2022 - - os: osx - runner: macos-14 - - os: linux - runner: ubuntu-22.04 - - os: ios - runner: macos-14 - - os: android - runner: ubuntu-22.04 - exclude: - - arch: arm - os: win - - arch: arm - os: osx - - arch: arm - os: linux - - arch: arm - os: ios - - arch: x86 - os: win - - arch: x86 - os: osx - - arch: x86 - os: linux - - arch: x86 - os: ios - - steps: - - name: Checkout ${{ github.repository }} - uses: actions/checkout@v4 - - - name: Configure Android NDK - uses: Devolutions/actions-public/cargo-android-ndk@v1 - if: matrix.os == 'android' - with: - android_api_level: "21" - - - name: Configure macOS deployement target - if: ${{ matrix.os == 'osx' }} - shell: pwsh - run: Write-Output "MACOSX_DEPLOYMENT_TARGET=10.10" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - - - name: Configure iOS deployement target - if: ${{ matrix.os == 'ios' }} - shell: pwsh - run: Write-Output "IPHONEOS_DEPLOYMENT_TARGET=12.1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - - - name: Update runner - if: ${{ matrix.os == 'linux' }} - run: sudo apt update - - - name: Install dependencies for rustls - if: ${{ runner.os == 'Windows' }} - shell: pwsh - run: | - choco install ninja nasm - - # We need to add the NASM binary folder to the PATH manually. - # We don’t need to do that for ninja. - Write-Output "PATH=$Env:PATH;$Env:ProgramFiles\NASM" >> $Env:GITHUB_ENV - - # libclang / LLVM is a requirement for AWS LC. - # https://aws.github.io/aws-lc-rs/requirements/windows.html#libclang--llvm - $VSINSTALLDIR = $(vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath) - Write-Output "LIBCLANG_PATH=$VSINSTALLDIR\VC\Tools\Llvm\x64\bin" >> $Env:GITHUB_ENV - - # Install Visual Studio Developer PowerShell Module for cmdlets such as Enter-VsDevShell - Install-Module VsDevShell -Force - - # No pre-generated bindings for Android and iOS. - # https://aws.github.io/aws-lc-rs/platform_support.html#pre-generated-bindings - - name: Install bindgen-cli for aws-lc-sys - if: ${{ matrix.os == 'android' || matrix.os == 'ios' }} - run: cargo install --force --locked bindgen-cli - - # For aws-lc-sys. Error returned otherwise: - # > Unable to generate bindings: ClangDiagnostic("/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found\n") - - name: Install gcc-multilib - if: ${{ matrix.os == 'android' }} - run: | - sudo apt-get update - sudo apt-get install gcc-multilib - - - name: Setup LLVM - uses: Devolutions/actions-public/setup-llvm@v1 - if: matrix.os == 'linux' - with: - version: "18.1.8" - - - name: Setup CBake - uses: Devolutions/actions-public/setup-cbake@v1 - if: matrix.os == 'linux' - with: - cargo_env_scripts: true - - - name: Build native lib (${{matrix.os}}-${{matrix.arch}}) - shell: pwsh - run: | - $DotNetOs = '${{matrix.os}}' - $DotNetArch = '${{matrix.arch}}' - $DotNetRid = '${{matrix.os}}-${{matrix.arch}}' - $RustArch = @{'x64'='x86_64';'arm64'='aarch64'; - 'x86'='i686';'arm'='armv7'}[$DotNetArch] - $RustPlatform = @{'win'='pc-windows-msvc'; - 'osx'='apple-darwin';'ios'='apple-ios'; - 'linux'='unknown-linux-gnu';'android'='linux-android'}[$DotNetOs] - $LibPrefix = @{'win'='';'osx'='lib';'ios'='lib'; - 'linux'='lib';'android'='lib'}[$DotNetOs] - $LibSuffix = @{'win'='.dll';'osx'='.dylib';'ios'='.dylib'; - 'linux'='.so';'android'='.so'}[$DotNetOs] - $RustTarget = "$RustArch-$RustPlatform" - - if (($DotNetOs -eq 'android') -and ($DotNetArch -eq 'arm')) { - $RustTarget = "armv7-linux-androideabi" - } - - rustup target add $RustTarget - - if ($DotNetOs -eq 'win') { - $Env:RUSTFLAGS="-C target-feature=+crt-static" - } - - $ProjectVersion = '${{ needs.preflight.outputs.project-version }}' - $PackageVersion = '${{ needs.preflight.outputs.package-version }}' - - $CargoToml = Get-Content .\ffi\Cargo.toml - $CargoToml = $CargoToml | ForEach-Object { - if ($_.StartsWith("version =")) { "version = `"$PackageVersion`"" } else { $_ } - } - Set-Content -Path .\ffi\Cargo.toml -Value $CargoToml - - if ($DotNetOs -eq 'linux') { - $LinuxArch = @{'x64'='amd64';'arm64'='arm64'}[$DotNetArch] - $Env:SYSROOT_NAME = "ubuntu-20.04-$LinuxArch" - . "$HOME/.cargo/cbake/${RustTarget}-enter.ps1" - $Env:AWS_LC_SYS_CMAKE_BUILDER="true" - } - - $CargoParams = @( - "build", - "-p", "ffi", - "--release", - "--target", "$RustTarget" - ) - - & cargo $CargoParams - - $OutputLibraryName = "${LibPrefix}ironrdp$LibSuffix" - $RenamedLibraryName = "${LibPrefix}DevolutionsIronRdp$LibSuffix" - $OutputLibrary = Join-Path "target" $RustTarget 'release' $OutputLibraryName - $OutputPath = Join-Path "dependencies" "runtimes" $DotNetRid "native" - New-Item -ItemType Directory -Path $OutputPath | Out-Null - Copy-Item $OutputLibrary $(Join-Path $OutputPath $RenamedLibraryName) - - - name: Upload native components - uses: actions/upload-artifact@v4 - with: - name: ironrdp-${{matrix.os}}-${{matrix.arch}} - path: dependencies/runtimes/${{matrix.os}}-${{matrix.arch}} - - build-universal: - name: Universal build - runs-on: ubuntu-22.04 - needs: [ preflight, build-native ] - strategy: - fail-fast: false - matrix: - os: [ osx, ios ] - - steps: - - name: Checkout ${{ github.repository }} - uses: actions/checkout@v4 - - - name: Setup CCTools - uses: Devolutions/actions-public/setup-cctools@v1 - - - name: Download native components - uses: actions/download-artifact@v4 - with: - path: dependencies/runtimes - - - name: Lipo native components - shell: pwsh - run: | - Set-Location "dependencies/runtimes" - # No RID for universal binaries, see: https://github.com/dotnet/runtime/issues/53156 - $OutputPath = Join-Path "${{ matrix.os }}-universal" "native" - New-Item -ItemType Directory -Path $OutputPath | Out-Null - $Libraries = Get-ChildItem -Recurse -Path "ironrdp-${{ matrix.os }}-*" -Filter "*.dylib" | Foreach-Object { $_.FullName } | Select -Unique - $LipoCmd = $(@('lipo', '-create', '-output', (Join-Path -Path $OutputPath -ChildPath "libDevolutionsIronRdp.dylib")) + $Libraries) -Join ' ' - Write-Host $LipoCmd - Invoke-Expression $LipoCmd - - - name: Framework - shell: pwsh - if: ${{ matrix.os == 'ios' }} - run: | - $Version = '${{ needs.preflight.outputs.project-version }}' - $ShortVersion = '${{ needs.preflight.outputs.package-version }}' - $BundleName = "libDevolutionsIronRdp" - $RuntimesDir = Join-Path "dependencies" "runtimes" "ios-universal" "native" - $FrameworkDir = Join-Path "$RuntimesDir" "$BundleName.framework" - New-Item -Path $FrameworkDir -ItemType "directory" -Force - $FrameworkExecutable = Join-Path $FrameworkDir $BundleName - Copy-Item -Path (Join-Path "$RuntimesDir" "$BundleName.dylib") -Destination $FrameworkExecutable -Force - - $RPathCmd = $(@('install_name_tool', '-id', "@rpath/$BundleName.framework/$BundleName", "$FrameworkExecutable")) -Join ' ' - Write-Host $RPathCmd - Invoke-Expression $RPathCmd - - [xml] $InfoPlistXml = Get-Content (Join-Path "ffi" "dotnet" "Devolutions.IronRdp" "Info.plist") - Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleIdentifier']/following-sibling::string[1]" | - %{ - $_.Node.InnerXml = "com.devolutions.ironrdp" - } - Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleExecutable']/following-sibling::string[1]" | - %{ - $_.Node.InnerXml = $BundleName - } - Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" | - %{ - $_.Node.InnerXml = $Version - } - Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]" | - %{ - $_.Node.InnerXml = $ShortVersion - } - - # Write the plist *without* a BOM - $Encoding = New-Object System.Text.UTF8Encoding($false) - $Writer = New-Object System.IO.StreamWriter((Join-Path $FrameworkDir "Info.plist"), $false, $Encoding) - $InfoPlistXml.Save($Writer) - $Writer.Close() - - # .NET XML document inserts two square brackets at the end of the DOCTYPE tag - # It's perfectly valid XML, but we're dealing with plists here and dyld will not be able to read the file - ((Get-Content -Path (Join-Path $FrameworkDir "Info.plist") -Raw) -Replace 'PropertyList-1.0.dtd"\[\]', 'PropertyList-1.0.dtd"') | Set-Content -Path (Join-Path $FrameworkDir "Info.plist") - - - name: Upload native components - uses: actions/upload-artifact@v4 - with: - name: ironrdp-${{ matrix.os }}-universal - path: dependencies/runtimes/${{ matrix.os }}-universal - - build-managed: - name: Managed build - runs-on: windows-2022 - needs: build-universal - - steps: - - name: Check out ${{ github.repository }} - uses: actions/checkout@v4 - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 - - - name: Install ios workload - run: dotnet workload install ios - - - name: Prepare dependencies - shell: pwsh - run: | - New-Item -ItemType Directory -Path "dependencies/runtimes" | Out-Null - - - name: Download native components - uses: actions/download-artifact@v4 - with: - path: dependencies/runtimes - - - name: Rename dependencies - shell: pwsh - run: | - Set-Location "dependencies/runtimes" - $(Get-Item ".\ironrdp-*") | ForEach-Object { Rename-Item $_ $_.Name.Replace("ironrdp-", "") } - Get-ChildItem * -Recurse - - - name: Build Devolutions.IronRdp (managed) - shell: pwsh - run: | - # net8.0 target packaged as Devolutions.IronRdp - dotnet build .\ffi\dotnet\Devolutions.IronRdp\Devolutions.IronRdp.csproj -c Release - # net8.0-ios target packaged as Devolutions.IronRdp.iOS - dotnet build .\ffi\dotnet\Devolutions.IronRdp\Devolutions.IronRdp.csproj -c Release /p:PackageId=Devolutions.IronRdp.iOS - - - name: Upload managed components - uses: actions/upload-artifact@v4 - with: - name: ironrdp-nupkg - path: ffi/dotnet/Devolutions.IronRdp/bin/Release/*.nupkg - - publish: - name: Publish NuGet package - runs-on: ubuntu-latest - environment: nuget-publish - if: needs.preflight.outputs.dry-run == 'false' - needs: - - preflight - - build-managed - - steps: - - name: Download NuGet package artifact - uses: actions/download-artifact@v4 - with: - name: ironrdp-nupkg - path: package - - - name: Publish to nuget.org - shell: pwsh - run: | - $Files = Get-ChildItem -Recurse package/*.nupkg - - foreach ($File in $Files) { - $PushCmd = @( - 'dotnet', - 'nuget', - 'push', - "$File", - '--api-key', - '${{ secrets.NUGET_API_KEY }}', - '--source', - 'https://api.nuget.org/v3/index.json', - '--skip-duplicate' - ) - - Write-Host "Publishing $($File.Name)..." - $PushCmd = $PushCmd -Join ' ' - Invoke-Expression $PushCmd - } - - notify: - name: Notify failure - runs-on: ubuntu-latest - if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }} - needs: - - preflight - - build-native - - build-universal - - build-managed - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ARCHITECTURE }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - steps: - - name: Send slack notification - id: slack - uses: slackapi/slack-github-action@v1.26.0 - with: - payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*${{ github.repository }}* :fire::fire::fire::fire::fire: \n The scheduled build for *${{ github.repository }}* is <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|broken>" - } - } - ] - } diff --git a/.github/workflows/release-crates.yml b/.github/workflows/release-crates.yml deleted file mode 100644 index 7465f76f..00000000 --- a/.github/workflows/release-crates.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Release crates - -permissions: - pull-requests: write - contents: write - -on: - workflow_dispatch: - push: - branches: - - master - -jobs: - # Create a PR with the new versions and changelog, preparing the next release. - open-pr: - name: Open release PR - runs-on: ubuntu-latest - environment: cratesio-publish - - concurrency: - group: release-plz-${{ github.ref }} - cancel-in-progress: false - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 512 - - - name: Run release-plz - id: release-plz - uses: Devolutions/actions-public/release-plz@v1 - with: - command: release-pr - git-name: Devolutions Bot - git-email: bot@devolutions.net - github-token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }} - - - name: Update fuzz/Cargo.lock - shell: pwsh - if: ${{ steps.release-plz.outputs.did-open-pr == 'true' }} - run: | - $prRaw = '${{ steps.release-plz.outputs.pr }}' - Write-Host "prRaw: $prRaw" - - $pr = $prRaw | ConvertFrom-Json - Write-Host "pr: $pr" - - Write-Host "Fetch branch $($pr.head_branch)" - git fetch origin "$($pr.head_branch)" - - Write-Host "Switch to branch $($pr.head_branch)" - git checkout "$($pr.head_branch)" - - Write-Host "Update ./fuzz/Cargo.lock" - cargo update --manifest-path ./fuzz/Cargo.toml - - Write-Host "Update last commit" - git add ./fuzz/Cargo.lock - git commit --amend --no-edit - - Write-Host "Update the release pull request" - git push --force - - # Release unpublished packages. - release: - name: Release crates - runs-on: ubuntu-latest - environment: cratesio-publish - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 512 - - - name: Run release-plz - uses: Devolutions/actions-public/release-plz@v1 - with: - command: release - registry-token: ${{ secrets.CRATES_IO_TOKEN }}