Skip to content
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

Chore/release ci #62

Merged
merged 8 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
minVersion: 0.24.0
changelogPolicy: auto
preReleaseCommand: pwsh scripts/bump-version.ps1
targets:
Copy link
Contributor

@bitsandfoxes bitsandfoxes Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "UPM" target following in another PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current plan is to stick to single repo and publish the three packages (one for each EngineVersion) as zip files as GH release artifacts.

I see.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more UPM, see PR description - for now we're sticking to a single repo

# TODO
# - name: symbol-collector
# includeNames: /libsentry(-android)?\.so/
# batchType: android
# bundleIdPrefix: sentry-unity-android-ndk-
- name: github
includeNames: /^sentry-unreal-.*.zip$/i
- name: registry
sdks:
github:sentry-unreal:
77 changes: 66 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,69 @@ name: package-plugin-workflow
on: [push]

jobs:
package-plugin-job:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

strategy:
matrix:
unreal: ['4.27', '5.0.2']
- name: Prepare Sentry packages for release
shell: pwsh
run: ./scripts/packaging/pack.ps1

- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
# Artifact name is the commit sha. Which is what craft uses to find the relevant artifact.
name: ${{ github.sha }}
if-no-files-found: error
path: |
sentry-unreal-*.zip
# Adding the native libraries so the symbol collector craft target can find/upload them
# TODO modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/*

package-validation:
needs: [build]
name: Validate package against snapshot
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Download packages
uses: actions/download-artifact@v2
with:
name: ${{ github.sha }}

# If this step fails, you can accept the new file content by
# running the following script locally with 'accept' as an argument
# and committing the new snapshot file to your branch. i.e:
# pwsh ./scripts/test-contents.ps1 accept
- name: Verify package content against snapshot
shell: pwsh
run: ./scripts/packaging/test-contents.ps1

# Smoke-test that the UnrealEnginge can package the plugin.
test-ue-packaging:
name: Test UE ${{ matrix.unreal }} packaging
runs-on: ubuntu-latest
needs: [build]

strategy:
fail-fast: false
matrix:
# Note: these versions must match scripts/packaging/engine-versions.txt
unreal: ['4.27', '5.0'] # 4.26 is not available

steps:
- name: Free disk space
if: ${{ steps.exists.outputs.value == 0 }}
run: |
# time df -h
sudo time swapoff -a
sudo time rm -f /swapfile
sudo time rm -rf /usr/local/lib/android
# sudo time rm -rf /usr/local/lib/android
sudo time rm -rf /usr/share/dotnet
sudo time rm -rf /usr/share/swift
sudo time rm -rf /usr/local/.ghcup
Expand All @@ -34,24 +79,34 @@ jobs:
# time du --max-depth=3 --threshold=100M -h /usr /opt /var 2>/dev/null | sort -hr
df -h

- name: Run Docker container
- name: Start Docker container
run: |
echo ${{ secrets.DOCKER_TOKEN }} | docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker run -td --name unreal --user root \
-v ${{ github.workspace }}/plugin-dev:/sentry-unreal \
-v ${{ github.workspace }}:/sentry-unreal \
--workdir /sentry-unreal \
ghcr.io/epicgames/unreal-engine:dev-slim-${{ matrix.unreal }}

- name: Installing Linux Dependencies
- name: Download packages
uses: actions/download-artifact@v2
with:
name: ${{ github.sha }}

- name: Unzip package from the build job
run: |
unzip sentry-unreal-*-engine${{ matrix.unreal }}.zip -d .
rm -f sentry-unreal-*.zip

- name: Install Linux Dependencies
run: |
docker exec unreal sudo apt-get update
docker exec unreal pip3 install --upgrade pip

- name: Installing UE CLI
- name: Install UE CLI
run:
docker exec unreal pip3 install ue4cli

- name: Configuring UE CLI
- name: Configure UE CLI
run:
docker exec unreal ue4 setroot /home/ue4/UnrealEngine

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: Version to release
required: true
force:
description: Force a release even when there are release-blockers (optional)
required: false

jobs:
job_release:
runs-on: ubuntu-latest
name: 'Release a new version: ${{ github.event.inputs.version }}'
steps:
- name: Check out current commit (${{ github.sha }})
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_RELEASE_PAT }}
fetch-depth: 0

- name: Prepare release ${{ github.event.inputs.version }}
uses: getsentry/action-prepare-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }}
with:
version: ${{ github.event.inputs.version }}
force: ${{ github.event.inputs.force }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ Intermediate/*

# Other
.DS_Store

# Ignore package release
package-release/
sentry-unreal-*.zip
19 changes: 19 additions & 0 deletions scripts/bump-version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Param(
[Parameter(Mandatory = $true)][String]$PrevVersion,
[Parameter(Mandatory = $true)][String]$NewVersion
)
Set-StrictMode -Version latest

$pluginFile = "$PSScriptRoot/../plugin-dev/Sentry.uplugin"

$content = Get-Content $pluginFile

$content -replace '"VersionName": ".*"', ('"VersionName": "' + $NewVersion + '"') | Out-File $pluginFile
if ("$content" -eq "$(Get-Content $pluginFile)")
{
$versionInFile = [regex]::Match("$content", '"VersionName": "([^"]+)"').Groups[1].Value
if ("$versionInFile" -ne "$NewVersion")
{
Throw "Failed to update version in $pluginFile - the content didn't change. The version found in the file is '$versionInFile'."
}
}
12 changes: 12 additions & 0 deletions scripts/packaging/android-libs.snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/arm64-v8a
/armeabi-v7a
/x86
/x86_64
arm64-v8a/libsentry-android.so
arm64-v8a/libsentry.so
armeabi-v7a/libsentry-android.so
armeabi-v7a/libsentry.so
x86/libsentry-android.so
x86/libsentry.so
x86_64/libsentry-android.so
x86_64/libsentry.so
3 changes: 3 additions & 0 deletions scripts/packaging/engine-versions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
5.0
4.27
4.26
22 changes: 22 additions & 0 deletions scripts/packaging/pack.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Remove-Item "package-release" -Recurse -ErrorAction SilentlyContinue
New-Item "package-release" -ItemType Directory

$exclude = @('Sentry.uplugin')

Copy-Item "plugin-dev/*" "package-release/" -Exclude $exclude -Recurse
Copy-Item "CHANGELOG.md" -Destination "package-release/CHANGELOG.md"
Copy-Item "LICENSE" -Destination "package-release/LICENSE"

$pluginSpec = Get-Content "plugin-dev/Sentry.uplugin"
$version = [regex]::Match("$pluginSpec", '"VersionName": "([^"]+)"').Groups[1].Value
$engineVersions = Get-Content $PSScriptRoot/engine-versions.txt
foreach ($engineVersion in $engineVersions)
{
$packageName = "sentry-unreal-$version-engine$engineVersion.zip"
Write-Host "Creating a release package for Unreal $engineVersion as $packageName"

$newPluginSpec = @($pluginSpec[0..0]) + @(' "EngineVersion" : "' + $engineVersion + '",') + @($pluginSpec[1..($pluginSpec.count)])
$newPluginSpec | Out-File 'package-release/Sentry.uplugin'

Compress-Archive "package-release/*" -DestinationPath $packageName -Force
}
Loading