Windows Build - OpenAPI Generation #17
This file contains 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
name: Windows Build - OpenAPI Generation | |
on: | |
workflow_call: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: [self-hosted, Windows] | |
steps: | |
# Gets the Unreal Repo and the CLI repo | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
path: unrealProject/ | |
- uses: actions/checkout@v4 | |
with: | |
repository: beamable/BeamableProduct | |
fetch-depth: 0 | |
lfs: true | |
path: BeamableProduct/ | |
ref: main | |
# Sets the buildType ENV var as either server or client. | |
- name: Set buildType ENV var | |
id: set-build-type | |
run: echo "buildType=client" >> $env:GITHUB_ENV | |
- name: Set hash ENV var | |
id: get_commit_hash | |
working-directory: unrealProject | |
run: echo "commit_hash=$(git rev-parse HEAD)" >> $env:GITHUB_ENV | |
- name: Check buildType ENV var | |
id: check-build-type | |
run: echo "${{ env.buildType }}" | |
# Installs .NET 8 so we can run init_repo.sh | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
# Make sure the .NET's paths are added to the shell's path ENV VAR | |
- run: Add-Content $env:GITHUB_PATH "C:\Program Files\dotnet" | |
- run: Add-Content $env:GITHUB_PATH "~\.dotnet\tools" | |
# Run Set-Packages for Unreal | |
- name: Run Set Packages for local build of the CLI | |
working-directory: ./BeamableProduct | |
shell: bash | |
run: bash set-packages.sh "${{ github.workspace }}/unrealProject/" "UNREAL_NugetSource" "" "" "${{ github.workspace }}/unrealProject/Microservices" | |
# Run init_repo.sh (needed to setup the project correctly locally) | |
- name: Prepare Repository for compilation | |
working-directory: ./unrealProject | |
shell: bash | |
run: bash init_repo.sh skip_waiting | |
- name: Remove old AutoGen code | |
working-directory: ./unrealProject | |
shell: powershell | |
run: | | |
Remove-Item -Recurse -Force Plugins/BeamableCore/Source/BeamableCore/Private/AutoGen | |
Remove-Item -Recurse -Force Plugins/BeamableCore/Source/BeamableCore/Public/AutoGen | |
- name: Update OpenAPI | |
working-directory: ./unrealProject | |
shell: bash | |
run: dotnet beam oapi generate --output Plugins/BeamableCore/Source --engine unreal | |
- name: Print problematic files | |
working-directory: ./unrealProject | |
shell: powershell | |
run: | | |
Get-Content -Path Plugins\BeamableCore\Source\BeamableCore\Public\AutoGen\FederationInfo.h | |
Get-Content -Path Plugins\BeamableCore\Source\BeamableCore\Private\AutoGen\FederationInfo.cpp | |
- name: Check for Changes | |
working-directory: ./unrealProject | |
id: changes | |
shell: bash | |
run: | | |
modified="$(git status --porcelain | grep 'Plugins/BeamableCore')" | |
lines=$(echo "${modified}" | wc -l) | |
if [ "$lines" -eq 0 ]; then | |
echo "any=false" >> $GITHUB_OUTPUT | |
else | |
echo "any=true" >> $GITHUB_OUTPUT | |
echo "Files: ${modified}" | |
fi | |
# Run clean for Unreal | |
- name: Clean project dir | |
working-directory: ./unrealProject | |
shell: bash | |
run: bash clean_project.sh | |
# Run init_repo.sh (needed to setup the project correctly locally) | |
- name: Prepare Repository for compilation | |
working-directory: unrealProject | |
if: ${{ steps.changes.outputs.any == 'true' }} | |
shell: bash | |
run: bash init_repo.sh skip_waiting | |
# Builds the image | |
- name: Build image | |
working-directory: unrealProject | |
shell: bash | |
run: bash windows_build.sh |