-
Notifications
You must be signed in to change notification settings - Fork 12
Switch to CPack for packaging #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dkropachev
wants to merge
14
commits into
scylladb:master
Choose a base branch
from
dkropachev:dk/switch-to-cpack-for-packaging
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dada754
Switch to CPack packager
dkropachev 90f711c
Remove old release files
dkropachev 5faebd6
Update build documentation
dkropachev e975b83
Fix linting
dkropachev 8a03959
Fix building for windows
dkropachev 7f323cc
Introduce and switch to CPack release workflow
dkropachev 8dc1676
Implement package testing
dkropachev cafddd7
1
dkropachev b5dee2a
1
dkropachev 383be92
1
dkropachev 53b56dc
static
dkropachev 45610ab
1
dkropachev c07d0a5
1
dkropachev e12fbe9
1
dkropachev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,256 @@ | ||
| name: Build CPack Packages | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| build-type: | ||
| description: CMake build type used for packaging | ||
| type: string | ||
| default: Release | ||
| extra-cmake-flags: | ||
| description: Additional flags passed to CMake configure step | ||
| type: string | ||
| default: "" | ||
| save-artifacts: | ||
| description: Save built packages as artifacts | ||
| type: boolean | ||
| default: false | ||
| secrets: {} | ||
| workflow_dispatch: | ||
| inputs: | ||
| build-type: | ||
| description: CMake build type used for packaging | ||
| type: string | ||
| default: Release | ||
| extra-cmake-flags: | ||
| description: Additional flags passed to CMake configure step | ||
| type: string | ||
| default: "" | ||
| save-artifacts: | ||
| description: Save built packages as artifacts | ||
| type: boolean | ||
| default: false | ||
| secrets: {} | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| CMAKE_BUILD_TYPE: ${{ inputs.build-type }} | ||
| CMAKE_FLAGS: ${{ inputs.extra-cmake-flags }} | ||
|
|
||
| jobs: | ||
| linux: | ||
| name: Linux packages | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build packages | ||
| run: make build-package | ||
|
|
||
| - name: Install driver dev package | ||
| run: make -C packaging/smoke-test-app install-driver-dev | ||
|
|
||
| - name: Install driver package | ||
| run: gmake -C packaging/smoke-test-app install-driver | ||
|
|
||
| - name: Build smoke-test application package | ||
| run: make -C packaging/smoke-test-app build-package | ||
|
|
||
| - name: Install smoke-test application package | ||
| run: make -C packaging/smoke-test-app install-app | ||
|
|
||
| - name: Test smoke-test application | ||
| run: make -C packaging/smoke-test-app test-app-package | ||
|
|
||
| - name: Collect artifacts | ||
| run: | | ||
| set -euo pipefail | ||
| shopt -s nullglob | ||
| mkdir -p artifacts/linux | ||
| for file in build/*.deb build/*.rpm; do | ||
| cp "$file" artifacts/linux/ | ||
| done | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| if: inputs.save-artifacts | ||
| with: | ||
| name: linux-packages | ||
| path: artifacts/linux | ||
| retention-days: 7 | ||
|
|
||
| macos: | ||
| name: macOS packages | ||
| runs-on: macos-15-intel | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install GNU make | ||
| run: brew install make | ||
|
|
||
| - name: Build packages | ||
| run: gmake build-package | ||
|
|
||
| - name: Install driver dev package | ||
| run: gmake -C packaging/smoke-test-app install-driver-dev | ||
|
|
||
| - name: Install driver package | ||
| run: gmake -C packaging/smoke-test-app install-driver | ||
|
|
||
| - name: Build smoke-test application package | ||
| run: gmake -C packaging/smoke-test-app build-package | ||
|
|
||
| - name: Install smoke-test application package | ||
| run: gmake -C packaging/smoke-test-app install-app | ||
|
|
||
| - name: Test smoke-test application | ||
| run: gmake -C packaging/smoke-test-app test-app-package | ||
|
|
||
| - name: Collect artifacts | ||
| run: | | ||
| set -euo pipefail | ||
| shopt -s nullglob | ||
| mkdir -p artifacts/macos | ||
| for file in build/*.pkg build/*.dmg \ | ||
| packaging/smoke-test-app/build/*.pkg \ | ||
| packaging/smoke-test-app/build/*.dmg; do | ||
| cp "$file" artifacts/macos/ | ||
| done | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| if: inputs.save-artifacts | ||
| with: | ||
| name: macos-packages | ||
| path: artifacts/macos | ||
| retention-days: 7 | ||
|
|
||
| windows: | ||
| name: Windows packages | ||
| runs-on: windows-2022 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Docker | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $dockerService = Get-Service -Name docker -ErrorAction SilentlyContinue | ||
| if (-not $dockerService) { | ||
| Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | ||
| Install-Module -Name DockerMsftProvider -Repository PSGallery -Force | ||
| Install-Package -Name docker -ProviderName DockerMsftProvider -Force | ||
| } | ||
| try { | ||
| Start-Service docker -ErrorAction Stop | ||
| } catch { | ||
| Write-Warning "Docker service failed to start: $($_.Exception.Message)" | ||
| } | ||
|
|
||
| - name: Add WiX to PATH | ||
| shell: pwsh | ||
| run: | | ||
| $wixPath = "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin" | ||
| if (Test-Path $wixPath) { Add-Content -Path $env:GITHUB_PATH -Value $wixPath } | ||
|
|
||
| - name: Build packages | ||
| run: make build-package | ||
|
|
||
| - name: Install driver packages (MSI) | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $packages = Get-ChildItem build -Filter *.msi | ||
| if (-not $packages) { | ||
| throw "No driver MSI packages produced" | ||
| } | ||
| Write-Host "Installing $($packages.Count) MSI package(s):" | ||
| foreach ($pkg in $packages) { | ||
| Write-Host " - $($pkg.Name)" | ||
| } | ||
| # Install all packages (Windows WIX creates a single MSI with components) | ||
| foreach ($pkg in $packages) { | ||
| $process = Start-Process msiexec.exe -ArgumentList "/i `"$($pkg.FullName)`" /qn /norestart" -Wait -PassThru | ||
| if ($process.ExitCode -ne 0) { | ||
| throw "Failed to install driver package $($pkg.Name): exit code $($process.ExitCode)" | ||
| } | ||
| } | ||
|
|
||
| - name: Verify dev package installation | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $installPath = "C:\Program Files\ScyllaDB\Scylla CPP Driver" | ||
| # Verify headers are installed | ||
| $headerPath = Join-Path $installPath "include\cassandra.h" | ||
| if (-not (Test-Path $headerPath)) { | ||
| throw "ERROR: cassandra.h header not found at $headerPath - dev package may not be installed" | ||
| } | ||
| # Verify pkg-config file is installed | ||
| $pkgConfigPath = Join-Path $installPath "lib\pkgconfig\scylla-cpp-driver.pc" | ||
| if (-not (Test-Path $pkgConfigPath)) { | ||
| throw "ERROR: scylla-cpp-driver.pc not found at $pkgConfigPath - dev package may not be installed" | ||
| } | ||
| Write-Host "Dev package verification successful" | ||
|
|
||
| - name: Build smoke-test application package | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $env:PKG_CONFIG_PATH = "C:/Program Files/ScyllaDB/Scylla CPP Driver/lib/pkgconfig" | ||
| cmake -S packaging/smoke-test-app -B packaging/smoke-test-app/build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} | ||
| cmake --build packaging/smoke-test-app/build --config ${{ inputs.build-type }} | ||
| Push-Location packaging/smoke-test-app/build | ||
| cpack -G WIX -C ${{ inputs.build-type }} | ||
| Pop-Location | ||
|
|
||
| - name: Install smoke-test application package (MSI) | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $packages = Get-ChildItem packaging/smoke-test-app/build -Filter *.msi | ||
| if (-not $packages) { | ||
| throw "No smoke-test MSI packages produced" | ||
| } | ||
| foreach ($pkg in $packages) { | ||
| $process = Start-Process msiexec.exe -ArgumentList "/i `"$($pkg.FullName)`" /qn /norestart" -Wait -PassThru | ||
| if ($process.ExitCode -ne 0) { | ||
| throw "Failed to install smoke-test package $($pkg.Name): exit code $($process.ExitCode)" | ||
| } | ||
| } | ||
|
|
||
| - name: Run smoke-test application against local Scylla | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $composeFile = "tests/examples_cluster/docker-compose.yml" | ||
| function Cleanup { | ||
| docker compose -f $composeFile down --remove-orphans | Out-Null | ||
| } | ||
| try { | ||
| $dockerService = Get-Service -Name docker -ErrorAction SilentlyContinue | ||
| if ($dockerService -and $dockerService.Status -ne 'Running') { | ||
| Start-Service docker | ||
| } | ||
| docker compose -f $composeFile up -d --wait | ||
| $smokePath = "C:\Program Files\ScyllaDB\Scylla CPP Driver Smoke Test\bin\scylla-cpp-driver-smoke-test.exe" | ||
| if (-not (Test-Path $smokePath)) { | ||
| throw "Smoke-test binary not found at $smokePath" | ||
| } | ||
| & $smokePath 172.43.0.2 | ||
| } finally { | ||
| Cleanup | ||
| } | ||
|
|
||
| - name: Collect artifacts | ||
| if: inputs.save-artifacts | ||
| shell: pwsh | ||
| run: | | ||
| New-Item -ItemType Directory -Path artifacts\windows -Force | Out-Null | ||
| Get-ChildItem build -Filter *.msi | Copy-Item -Destination artifacts\windows | ||
| Get-ChildItem packaging/smoke-test-app/build -Filter *.msi | Copy-Item -Destination artifacts\windows | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| if: inputs.save-artifacts | ||
| with: | ||
| name: windows-packages | ||
| path: artifacts/windows | ||
| retention-days: 7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Attach Packages to Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| release-tag: | ||
| description: release tag | ||
| type: string | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build-packages: | ||
| uses: ./.github/workflows/build-cpack-packages.yml | ||
| with: | ||
| save-artifacts: true | ||
| build-type: Release | ||
| secrets: inherit | ||
|
|
||
| publish: | ||
| name: Upload artifacts to release | ||
| runs-on: ubuntu-22.04 | ||
| needs: build-packages | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| path: packages | ||
| - name: Upload packages to GitHub Release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| TAG_NAME: ${{ inputs.release-tag || github.event.release.tag_name }} | ||
| run: | | ||
| set -euo pipefail | ||
| shopt -s nullglob | ||
| for file in packages/*/*; do | ||
| echo "Uploading $file" | ||
| gh release upload "$TAG_NAME" "$file" --clobber | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 It's a pity we need to be that WET instead of DRY. Chat GPT, however, hasn't come up with a better solution for enabling both manual dispatch and being called from another workflow, both with the same parameters and configuration.