Skip to content

Commit

Permalink
Merge pull request #6 from RedpointGames/github-actions
Browse files Browse the repository at this point in the history
Move CI/CD to GitHub Actions
  • Loading branch information
hach-que authored Oct 31, 2024
2 parents 1293ef2 + 9a0e369 commit edfa8a9
Show file tree
Hide file tree
Showing 18 changed files with 1,159 additions and 527 deletions.
85 changes: 85 additions & 0 deletions .github/actions/dotnet-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Install .NET SDK
description: Install the .NET SDK
inputs:
UET_FRAMEWORK_TARGET:
description: "The target framework."
required: true
runs:
using: 'composite'
steps:
- name: Cache .NET SDK (Windows)
if: ${{ runner.os == 'Windows' }}
id: cache-sdk-win
uses: actions/cache@v4
with:
key: dotnet-sdk-windows-${{ inputs.UET_FRAMEWORK_TARGET }}
restore-keys: dotnet-sdk-windows-${{ inputs.UET_FRAMEWORK_TARGET }}
path: .dotnet-${{ inputs.UET_FRAMEWORK_TARGET }}
- name: Cache .NET SDK (macOS)
if: ${{ runner.os == 'macOS' }}
id: cache-sdk-mac
uses: actions/cache@v4
with:
key: dotnet-sdk-mac-${{ inputs.UET_FRAMEWORK_TARGET }}
restore-keys: dotnet-sdk-mac-${{ inputs.UET_FRAMEWORK_TARGET }}
path: .dotnet-${{ inputs.UET_FRAMEWORK_TARGET }}
- name: Download .NET SDK (Windows)
if: ${{ runner.os == 'Windows' && steps.cache-sdk-win.outputs.cache-hit != 'true' }}
shell: pwsh
env:
UET_FRAMEWORK_TARGET: ${{ inputs.UET_FRAMEWORK_TARGET }}
UET_DOTNET_WIN_DL: https://download.visualstudio.microsoft.com/download/pr/6902745c-34bd-4d66-8e84-d5b61a17dfb7/e61732b00f7e144e162d7e6914291f16/dotnet-sdk-8.0.101-win-x64.zip
run: |
if (!(Test-Path .dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet\dotnet-extracted)) {
if (Test-Path ".dotnet-${env:UET_FRAMEWORK_TARGET}") {
Remove-Item -Recurse -Force ".dotnet-${env:UET_FRAMEWORK_TARGET}"
}
Write-Host "Setting up .NET SDK..."
New-Item -ItemType Directory ".dotnet-${env:UET_FRAMEWORK_TARGET}" | Out-Null
curl.exe -L -o ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet.zip" "${env:UET_DOTNET_WIN_DL}"
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
Expand-Archive -Path ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet.zip" -DestinationPath ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet" -Force | Out-Null
Set-Content -Path .dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet\dotnet-extracted -Value "done"
}
- name: Download .NET SDK (macOS)
if: ${{ runner.os == 'macOS' && steps.cache-sdk-mac.outputs.cache-hit != 'true' }}
shell: pwsh
env:
UET_FRAMEWORK_TARGET: ${{ inputs.UET_FRAMEWORK_TARGET }}
UET_DOTNET_MAC_DL: https://download.visualstudio.microsoft.com/download/pr/ef083c06-7aee-4a4f-b18b-50c9a8990753/e206864e7910e81bbd9cb7e674ff1b4c/dotnet-sdk-8.0.101-osx-arm64.tar.gz
run: |
if (!(Test-Path .dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet/dotnet-extracted)) {
if (Test-Path ".dotnet-${env:UET_FRAMEWORK_TARGET}") {
Remove-Item -Recurse -Force ".dotnet-${env:UET_FRAMEWORK_TARGET}"
}
Write-Host "Setting up .NET SDK..."
New-Item -ItemType Directory ".dotnet-${env:UET_FRAMEWORK_TARGET}" | Out-Null
curl -L -o ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet.tar.gz" "${env:UET_DOTNET_MAC_DL}"
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
New-Item -ItemType Directory ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet" | Out-Null
Push-Location ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet"
try {
tar -xvf "../dotnet.tar.gz"
} finally {
Pop-Location
}
Set-Content -Path .dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet/dotnet-extracted -Value "done"
}
- name: Add .NET SDK to PATH (Windows)
if: ${{ runner.os == 'Windows' }}
shell: pwsh
env:
UET_FRAMEWORK_TARGET: ${{ inputs.UET_FRAMEWORK_TARGET }}
run: |
Add-Content -Path "${env:GITHUB_PATH}" -Value ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet"
- name: Add .NET SDK to PATH (macOS)
if: ${{ runner.os == 'macOS' }}
shell: pwsh
env:
UET_FRAMEWORK_TARGET: ${{ inputs.UET_FRAMEWORK_TARGET }}
run: |
Add-Content -Path "${env:GITHUB_PATH}" -Value ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet"
104 changes: 104 additions & 0 deletions .github/actions/download-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Download Artifact
description: Download a named artifact
inputs:
UET_ARTIFACT_NAME:
description: "The known name of the artifact."
required: true
runs:
using: 'composite'
steps:
- name: Download Timestamp
if: ${{ inputs.UET_ARTIFACT_NAME == 'timestamp' }}
uses: actions/download-artifact@v4
with:
name: timestamp
path: ""
merge-multiple: true

- name: Download AutoDiscovery
if: ${{ inputs.UET_ARTIFACT_NAME == 'autodiscovery' }}
uses: actions/download-artifact@v4
with:
name: autodiscovery
path: UET/
merge-multiple: true
- name: Download Mac Logging
if: ${{ inputs.UET_ARTIFACT_NAME == 'mac-logging' }}
uses: actions/download-artifact@v4
with:
name: mac-logging
path: UET/
merge-multiple: true

- name: Download UEFS Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'uefs-win' }}
uses: actions/download-artifact@v4
with:
name: uefs-win
path: UET/
merge-multiple: true
- name: Download Shim Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'shim-win' }}
uses: actions/download-artifact@v4
with:
name: shim-win
path: UET/uet.shim/bin/Release/net8.0/win-x64/publish/
merge-multiple: true
- name: Download Pass 1 Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-1-win' }}
uses: actions/download-artifact@v4
with:
name: pass-1-win
path: UET/uet/bin/Release/net8.0/win-x64/publish/
merge-multiple: true
- name: Download Pass 2 Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-2-win' }}
uses: actions/download-artifact@v4
with:
name: pass-2-win
path: UET/uet/bin/Release/net8.0/win-x64/publish/
merge-multiple: true

- name: Download UEFS Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'uefs-mac' }}
uses: actions/download-artifact@v4
with:
name: uefs-mac
path: UET/
merge-multiple: true
- name: Download Shim Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'shim-mac' }}
uses: actions/download-artifact@v4
with:
name: shim-mac
path: UET/uet.shim/bin/Release/net8.0/osx-arm64/publish/
merge-multiple: true
- name: Download Pass 1 Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-1-mac' }}
uses: actions/download-artifact@v4
with:
name: pass-1-mac
path: UET/uet/bin/Release/net8.0/osx-arm64/publish/
merge-multiple: true
- name: Download Pass 2 Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-2-mac' }}
uses: actions/download-artifact@v4
with:
name: pass-2-mac
path: UET/uet/bin/Release/net8.0/osx-arm64/publish/
merge-multiple: true

- name: Download Libs Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'libs-win' }}
uses: actions/download-artifact@v4
with:
name: libs-win
path: UET/
merge-multiple: true
- name: Download Libs Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'libs-mac' }}
uses: actions/download-artifact@v4
with:
name: libs-mac
path: UET/
merge-multiple: true
129 changes: 129 additions & 0 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Upload Artifact
description: Upload a named artifact
inputs:
UET_ARTIFACT_NAME:
description: "The known name of the artifact."
required: true
UET_FRAMEWORK_TARGET:
description: "The target framework."
required: true
runs:
using: 'composite'
steps:
- name: Upload Timestamp
if: ${{ inputs.UET_ARTIFACT_NAME == 'timestamp' }}
uses: actions/upload-artifact@v4
with:
name: timestamp
if-no-files-found: error
path: |
package.version
- name: Upload AutoDiscovery
if: ${{ inputs.UET_ARTIFACT_NAME == 'autodiscovery' }}
uses: actions/upload-artifact@v4
with:
name: autodiscovery
if-no-files-found: error
path: |
UET/Redpoint.AutoDiscovery.Win64/bin/x64/Debug/${{ inputs.UET_FRAMEWORK_TARGET }}/**
UET/Redpoint.AutoDiscovery.Win32/bin/x86/Debug/${{ inputs.UET_FRAMEWORK_TARGET }}/**
UET/Redpoint.AutoDiscovery.Win64/bin/x64/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/**
UET/Redpoint.AutoDiscovery.Win32/bin/x86/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/**
UET/Redpoint.AutoDiscovery/bin/Release/Redpoint.AutoDiscovery.*.nupkg
- name: Upload Mac Logging
if: ${{ inputs.UET_ARTIFACT_NAME == 'mac-logging' }}
uses: actions/upload-artifact@v4
with:
name: mac-logging
if-no-files-found: error
path: |
UET/Redpoint.Logging.Mac.Native/runtimes/osx-arm64/libLogging.arm64.dylib
UET/Redpoint.Logging.Mac.Native/runtimes/osx-x64/libLogging.x64.dylib
UET/Redpoint.Logging.Mac/bin/Redpoint.Logging.Mac.Native.*.nupkg
- name: Upload UEFS Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'uefs-win' }}
uses: actions/upload-artifact@v4
with:
name: uefs-win
if-no-files-found: error
path: |
UET/Redpoint.Uefs.Client/bin/Release/net8.0/win-x64/publish/uefs.exe
UET/Redpoint.Uefs.Daemon/bin/Release/net8.0/win-x64/publish/uefs-daemon.exe
- name: Upload Shim Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'shim-win' }}
uses: actions/upload-artifact@v4
with:
name: shim-win
if-no-files-found: error
path: |
UET/uet.shim/bin/Release/net8.0/win-x64/publish/uet.exe
- name: Upload Pass 1 Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-1-win' }}
uses: actions/upload-artifact@v4
with:
name: pass-1-win
if-no-files-found: error
path: |
UET/uet/bin/Release/net8.0/win-x64/publish/uet.exe
- name: Upload Pass 2 Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-2-win' }}
uses: actions/upload-artifact@v4
with:
name: pass-2-win
if-no-files-found: error
path: |
UET/uet/bin/Release/net8.0/win-x64/publish/uet.exe
- name: Upload UEFS Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'uefs-mac' }}
uses: actions/upload-artifact@v4
with:
name: uefs-mac
if-no-files-found: error
path: |
UET/Redpoint.Uefs.Client/bin/Release/net8.0/osx-arm64/publish/uefs
UET/Redpoint.Uefs.Daemon/bin/Release/net8.0/osx-arm64/publish/uefs-daemon
- name: Upload Shim Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'shim-mac' }}
uses: actions/upload-artifact@v4
with:
name: shim-mac
if-no-files-found: error
path: |
UET/uet.shim/bin/Release/net8.0/osx-arm64/publish/uet
- name: Upload Pass 1 Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-1-mac' }}
uses: actions/upload-artifact@v4
with:
name: pass-1-mac
if-no-files-found: error
path: |
UET/uet/bin/Release/net8.0/osx-arm64/publish/uet
- name: Upload Pass 2 Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-2-mac' }}
uses: actions/upload-artifact@v4
with:
name: pass-2-mac
if-no-files-found: error
path: |
UET/uet/bin/Release/net8.0/osx-arm64/publish/uet
- name: Upload Libs Win
if: ${{ inputs.UET_ARTIFACT_NAME == 'libs-win' }}
uses: actions/upload-artifact@v4
with:
name: libs-win
if-no-files-found: error
path: |
**/*.nupkg
- name: Upload Libs Mac
if: ${{ inputs.UET_ARTIFACT_NAME == 'libs-mac' }}
uses: actions/upload-artifact@v4
with:
name: libs-mac
if-no-files-found: error
path: |
**/*.nupkg
Loading

0 comments on commit edfa8a9

Please sign in to comment.