Closed Minimata closed 7 months ago
Thank you for this pull request. I will review it and merge in this weekend. On the note of improvements:
.unreal
file in the root of the actions runner that is read in the Set Unreal Environment Variables
step that contains:ARCHIVE_PATH=\\ORCHIDNAS\OrchidIsleGames\
RUNUAT_PATH54=C:\UnrealEngine\Engine\Build\BatchFiles\RunUAT.bat
SEVEN_Z_PATH=C:\Program Files\7-Zip\7z.exe
Here is an example of our full build process for a Win64 build:
name: Build Win64 Client
on:
release:
types: [created]
push:
branches:
- dev
jobs:
build:
runs-on: [UE54]
environment: ${{
(github.ref == 'refs/heads/dev' && 'Development') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-alpha') && 'Staging') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-beta') && 'Staging') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-rc') && 'Staging') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') && 'Production') ||
'Development'
}}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{ secrets.ACCESS_TOKEN }}
lfs: false
fetch-depth: 0 # Fetches all history for all tags and branches
submodules: recursive
- name: Set Unreal Environment Variables
run: |
Get-Content "${{ github.workspace }}\..\..\..\.unreal" | ForEach-Object {
$split = $_ -split '=', 2
$name = $split[0]
$value = $split[1]
Add-Content -Path $env:GITHUB_ENV -Value "$name=$value"
}
- name: Get Project Version and Build Number
uses: OrchidIsle/UE5-Semantic-Versioning@latest
with:
BUILD_PREFIX: ${{ github.ref_name }}
CONFIG_DIR_PATH: ${{ github.workspace }}\MyProject\Config
ADD_BUILD_INFO: true
USE_RELEASE_BUILD: ${{ github.event_name == 'release' }}
- name: Cook, Stage & Package UE Project
uses: OrchidIsle/UE5-Build-Project@latest
with:
RUNUAT_PATH: ${{ env.RUNUAT_PATH54 }}
UPROJECT_PATH: ${{ github.workspace }}\MyProject\MyProject.uproject
BUILD_CONFIG: ${{ vars.BUILD_CONFIG }}
PLATFORM: Win64
COOK: true
STAGE: true
PACKAGE: true
PAK: true
SERVER: false
EDITOR: true
ENCRYPT_INI: true
- name: Compress Win64 Client using 7-Zip
run: |
$7zPath = "${{ env.SEVEN_Z_PATH }}"
$sourceDir = "${{ github.workspace }}\MyProject\Saved\StagedBuilds\Windows"
$archiveFile = "MyProject-Win64-${{ env.BUILD_ID }}.zip"
& "$7zPath" a -tzip "$archiveFile" "$sourceDir\*"
- name: Copy to Archive
run: |
$sourcePath = "MyProject-Win64-${{ env.BUILD_ID }}.zip"
$destinationPath = "${{ env.ARCHIVE_PATH }}\MyProject\Builds\Win64\MyProject-Win64-${{ env.BUILD_ID }}.zip" # Replace with your destination folder path
$destinationDirectory = Split-Path -Path $destinationPath -Parent
if (-not (Test-Path -Path $destinationDirectory)) {
New-Item -ItemType Directory -Path $destinationDirectory
}
Copy-Item -Path $sourcePath -Destination $destinationPath
- name: Upload Build to Amazon S3
uses: NotCoffee418/s3-zip-upload@v1.4
env:
AWS_SECRET_ID: ${{ secrets.DOWNLOAD_AWS_KEY_ID }}
AWS_SECRET_KEY: ${{ secrets.DOWNLOAD_AWS_SECRET_ACCESS_KEY }}
BUCKET_NAME: ${{ secrets.DOWNLOAD_AWS_BUCKET }}
AWS_REGION: us-east-1
SOURCE_MODE: FILE
SOURCE_PATH: ./MyProject-Win64-${{ env.BUILD_ID }}.zip
DEST_FILE: MyProject/Win64/MyProject-Win64-${{ env.BUILD_ID }}.zip
- name: Upload Latest Full Release
if: github.event_name == 'release'
uses: NotCoffee418/s3-zip-upload@v1.4
env:
AWS_SECRET_ID: ${{ secrets.DOWNLOAD_AWS_KEY_ID }}
AWS_SECRET_KEY: ${{ secrets.DOWNLOAD_AWS_SECRET_ACCESS_KEY }}
BUCKET_NAME: ${{ secrets.DOWNLOAD_AWS_BUCKET }}
AWS_REGION: us-east-1
SOURCE_MODE: FILE
SOURCE_PATH: ./MyProject-Win64-${{ env.BUILD_ID }}.zip
DEST_FILE: MyProject/MyProject-Win64-Latest.zip
In regards to the Linux support [...]
Okay though I think we misunderstood each other here. I try to containerize my actions as much as possible but windows containers are difficult to work with so all my container work is done on Linux, like so:
jobs:
RunTests:
runs-on: ubuntu-latest
container: ghcr.io/epicgames/unreal-engine:dev-slim-5.3.2
# ...
The need for a Linux-based action is therefore not so much to compile and build for Linux specifically but to support this container-based approach. If you think a branch is fine then that's cool with me. Do you want me to provide you with the code for it? I'm not a shell expert but I could probably manage.
I noticed this with the PDB files. I will create a bug report and look into addressing this.
Great stuff, thanks!
For compression, we felt that it would be best utilized as a separate step in the main action.
That's fair enough.
We create a .unreal file in the root of the actions runner that is read in the Set Unreal Environment Variables step that contains:
So if I understand correctly this .unreal
file is sort of a .env
file that points to the relevant paths on your computer for the action to run is that it ? This suggests all of this only runs on your computer.
7Zip is interesting, I'm simply doing a Compress-Archive
but 7zip is probably a better approach, I should try it out.
Here is an example of our full build process for a Win64 build:
That's so cool ! Helps a lot. I didn't think a build would work without LFS and wondered how that would go now that my checkouts take an hour but I'm definitely getting rid of downloading all large files now !
Your branch handling is interesting too though quite different from mine. I strive for a trunk-based approach and have not experimented with Development
, Staging
or Production
builds.
Thanks for all this info and for merging as well !
TL;DR
Hi, I wanted to use your Github Action for my project but ended up having to tweak a few things to my use cases. The changes shouldn't impact current action usage but allow for a wider variety of situations (including mine), therefore I think a PR is in order to complement your Action instead of creating a similar yet different one.
Features
CLEAN
input parameter: I added aCLEAN
input that translates to the-clean
flag in theRunUAT
command. This lets the user clean the solution therefore transforming thebuild
into arebuild
. This helped me overcome an issue when running the action after a plugin update where the simplebuild
option would leave some targets out-of-date which spawned some errors whereas with-clean
it worked fine. Defaults tofalse
so it doesn't impact current action usage.NULLRHI
input parameter: I added aNULLRHI
input that translates to the-nullrhi
flag in theRunUAT
command. The flag is needed when running theRunUAT
on a device that doesn't have a video output. This is useful in my case because I'm running my jobs in containers on the cloud and on my on-prem server which both lack video output. Even when jobs run on my personal machine I like to disable video output to keep them in the background so it doesn't disrupt my work too much. Defaults tofalse
so it doesn't impact current action usage.RunUAT
command would build all maps. On smaller projects, prototypes or game jams this becomes useful because there's only a few maps to build so it's easier not to have to type them (prevents typos and such). The default value for themaps
input translates to basically no command flag related to maps for theRunUAT
command which therefore builds everything.Fixes
ARCHIVE_PATH
may now contain spaces: Due to the way this parameter was escaped, theARCHIVE_PATH
directory could not contain spaces. I simply recycled the syntax you used to escape theRUNUAT_PATH
and theUPROJECT_PATH
and applied it to theARCHIVE_PATH
input parameter.Possible improvements
linux
branch in the repo would work with basically the same script but running ashell
instead of apowershell
. Don't know how clean this looks to you though, what do you think?RunUAT
command still exports the PDB symbols files when running inShipping
mode, which take some valuable storage space in the repository. What I'm usually doing when packaging forShipping
is removing these PDB files with a one-liner command. This could be aDELETE_PDB
input parameter to the action though it would mean the action does more than just running theRunUAT
command, which is why I didn't include it in my PR since this is quite an important change from your original Action.ZIP_ARCHIVE
input or something, but again didn't want to change your action too much without your input first.Misc
Conclusion
Thank you for creating this little action which is a smooth entry into the world of Github Actions and CI/CD for Unreal Engine. I hope you'll accept the request so that we may continue to use a single action for this purpose instead of duplicating functionality in the Action marketplace. I look forward to getting your advice on the possible improvements listed above.
Cheers,