diff --git a/.github/actions/download-artifact/action.yml b/.github/actions/download-artifact/action.yml index d23bc854..4d6a1768 100644 --- a/.github/actions/download-artifact/action.yml +++ b/.github/actions/download-artifact/action.yml @@ -90,6 +90,28 @@ runs: name: pass-2-mac path: UET/uet/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/osx-arm64/publish/ merge-multiple: true + + - name: Download Shim Linux + if: ${{ inputs.UET_ARTIFACT_NAME == 'shim-linux' }} + uses: actions/download-artifact@v4 + with: + name: shim-linux + path: UET/uet.shim/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/linux-x64/publish/ + merge-multiple: true + - name: Download Pass 1 Linux + if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-1-linux' }} + uses: actions/download-artifact@v4 + with: + name: pass-1-linux + path: UET/uet/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/linux-x64/publish/ + merge-multiple: true + - name: Download Pass 2 Linux + if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-2-linux' }} + uses: actions/download-artifact@v4 + with: + name: pass-2-linux + path: UET/uet/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/linux-x64/publish/ + merge-multiple: true - name: Download Libs Win if: ${{ inputs.UET_ARTIFACT_NAME == 'libs-win' }} diff --git a/.github/actions/upload-artifact/action.yml b/.github/actions/upload-artifact/action.yml index d7b08722..d1ffe780 100644 --- a/.github/actions/upload-artifact/action.yml +++ b/.github/actions/upload-artifact/action.yml @@ -110,6 +110,31 @@ runs: path: | UET/uet/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/osx-arm64/publish/uet + - name: Upload Shim Linux + if: ${{ inputs.UET_ARTIFACT_NAME == 'shim-linux' }} + uses: actions/upload-artifact@v4 + with: + name: shim-linux + if-no-files-found: error + path: | + UET/uet.shim/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/linux-x64/publish/uet + - name: Upload Pass 1 Linux + if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-1-linux' }} + uses: actions/upload-artifact@v4 + with: + name: pass-1-linux + if-no-files-found: error + path: | + UET/uet/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/linux-x64/publish/uet + - name: Upload Pass 2 Linux + if: ${{ inputs.UET_ARTIFACT_NAME == 'pass-2-linux' }} + uses: actions/upload-artifact@v4 + with: + name: pass-2-linux + if-no-files-found: error + path: | + UET/uet/bin/Release/${{ inputs.UET_FRAMEWORK_TARGET }}/linux-x64/publish/uet + - name: Upload Libs Win if: ${{ inputs.UET_ARTIFACT_NAME == 'libs-win' }} uses: actions/upload-artifact@v4 diff --git a/.github/workflows/uet.yml b/.github/workflows/uet.yml index c2506031..d2937818 100644 --- a/.github/workflows/uet.yml +++ b/.github/workflows/uet.yml @@ -386,6 +386,54 @@ jobs: UET_ARTIFACT_NAME: shim-mac UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + shim-linux: + name: "Build Linux Shim" + runs-on: ubuntu-latest + needs: + - timestamp + - prereq-autodiscovery + - prereq-mac-logging + env: + UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install .NET SDK + uses: ./.github/actions/dotnet-sdk + with: + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download AutoDiscovery + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: autodiscovery + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Mac Logging + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: mac-logging + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Build UET Shim + shell: pwsh + run: | + dotnet ` + msbuild ` + -restore ` + -t:Publish ` + -p:RuntimeIdentifier=linux-x64 ` + -p:Configuration=Release ` + -p:UetSkipNuGetPackaging=true ` + "-p:BaseUetVersion=${env:UET_PACKAGE_VERSION}" ` + "-p:PackageVersion=${env:UET_PACKAGE_VERSION}" ` + UET/uet.shim/uet.shim.csproj + if ($LastExitCode -ne 0) { exit $LastExitCode } + - name: Upload Binaries + uses: ./.github/actions/upload-artifact + with: + UET_ARTIFACT_NAME: shim-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + pass-1-win: name: "Build Windows Pass 1" runs-on: windows-latest @@ -485,6 +533,54 @@ jobs: UET_ARTIFACT_NAME: pass-1-mac UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + pass-1-linux: + name: "Build Linux Pass 1" + runs-on: ubuntu-latest + needs: + - timestamp + - prereq-autodiscovery + - prereq-mac-logging + env: + UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install .NET SDK + uses: ./.github/actions/dotnet-sdk + with: + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download AutoDiscovery + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: autodiscovery + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Mac Logging + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: mac-logging + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Build UET Pass 1 + shell: pwsh + run: | + dotnet ` + msbuild ` + -restore ` + -t:Publish ` + -p:RuntimeIdentifier=linux-x64 ` + -p:Configuration=Release ` + -p:UetSkipNuGetPackaging=true ` + "-p:BaseUetVersion=${env:UET_PACKAGE_VERSION}" ` + "-p:PackageVersion=${env:UET_PACKAGE_VERSION}" ` + UET/uet/uet.csproj + if ($LastExitCode -ne 0) { exit $LastExitCode } + - name: Upload Binaries + uses: ./.github/actions/upload-artifact + with: + UET_ARTIFACT_NAME: pass-1-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + libs-win: name: "Build and Test Libraries on Windows" runs-on: windows-latest @@ -594,6 +690,7 @@ jobs: - prereq-mac-logging - pass-1-win - pass-1-mac + - pass-1-linux env: UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} steps: @@ -625,6 +722,11 @@ jobs: with: UET_ARTIFACT_NAME: pass-1-mac UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Linux Pass 1 + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: pass-1-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} - name: Build UET Pass 2 shell: pwsh run: | @@ -655,6 +757,7 @@ jobs: - prereq-mac-logging - pass-1-win - pass-1-mac + - pass-1-linux env: UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} steps: @@ -686,6 +789,11 @@ jobs: with: UET_ARTIFACT_NAME: pass-1-mac UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Linux Pass 1 + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: pass-1-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} - name: Build UET Pass 2 shell: pwsh run: | @@ -710,6 +818,76 @@ jobs: UET_ARTIFACT_NAME: pass-2-mac UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + pass-2-linux: + name: "Build Linux Pass 2" + runs-on: ubuntu-latest + needs: + - timestamp + - prereq-autodiscovery + - prereq-mac-logging + - pass-1-win + - pass-1-mac + - pass-1-linux + env: + UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install .NET SDK + uses: ./.github/actions/dotnet-sdk + with: + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download AutoDiscovery + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: autodiscovery + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Mac Logging + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: mac-logging + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Windows Pass 1 + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: pass-1-win + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download macOS Pass 1 + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: pass-1-mac + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Linux Pass 1 + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: pass-1-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Build UET Pass 2 + shell: pwsh + run: | + dotnet ` + msbuild ` + -restore ` + -t:Publish ` + -p:RuntimeIdentifier=linux-x64 ` + -p:Configuration=Release ` + -p:EmbeddingCrossPlatform=true ` + -p:UetSkipNuGetPackaging=true ` + "-p:BaseUetVersion=${env:UET_PACKAGE_VERSION}" ` + "-p:PackageVersion=${env:UET_PACKAGE_VERSION}" ` + UET/uet/uet.csproj + if ($LastExitCode -ne 0) { exit $LastExitCode } + # Ensure the thing we built will actually run... + ./UET/uet/bin/Release/${{ env.UET_FRAMEWORK_TARGET }}/linux-x64/publish/uet --help + if ($LastExitCode -ne 0) { exit $LastExitCode } + - name: Upload Binaries + uses: ./.github/actions/upload-artifact + with: + UET_ARTIFACT_NAME: pass-2-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + test-schema-generate: name: "Test Schema Generation" runs-on: windows-latest @@ -753,8 +931,10 @@ jobs: - uefs-mac - shim-win - shim-mac + - shim-linux - pass-2-win - pass-2-mac + - pass-2-linux env: UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} steps: @@ -799,8 +979,10 @@ jobs: - uefs-mac - shim-win - shim-mac + - shim-linux - pass-2-win - pass-2-mac + - pass-2-linux env: UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} steps: @@ -838,6 +1020,16 @@ jobs: with: UET_ARTIFACT_NAME: pass-2-mac UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Linux Shim + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: shim-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Download Linux Pass 2 + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: pass-2-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} - name: Download package.version uses: ./.github/actions/download-artifact with: @@ -858,6 +1050,8 @@ jobs: --file "uefs=UEFS Client for macOS=UET/Redpoint.Uefs.Client/bin/Release/${{ env.UET_FRAMEWORK_TARGET }}/osx-arm64/publish/uefs" ` --file "uefs-daemon=UEFS Daemon for macOS=UET/Redpoint.Uefs.Daemon/bin/Release/${{ env.UET_FRAMEWORK_TARGET }}/osx-arm64/publish/uefs-daemon" ` --file "uet.shim=UET Shim for macOS=UET/uet.shim/bin/Release/${{ env.UET_FRAMEWORK_TARGET }}/osx-arm64/publish/uet" ` + --file "uet.linux=UET for Linux=UET/uet/bin/Release/${{ env.UET_FRAMEWORK_TARGET }}/linux-x64/publish/uet" ` + --file "uet.linux.shim=UET Shim for Linux=UET/uet.shim/bin/Release/${{ env.UET_FRAMEWORK_TARGET }}/linux-x64/publish/uet" ` --file "package.version=Version File=package.version" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } @@ -878,8 +1072,10 @@ jobs: - uefs-mac - shim-win - shim-mac + - shim-linux - pass-2-win - pass-2-mac + - pass-2-linux env: UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} steps: @@ -904,3 +1100,57 @@ jobs: docker buildx create --name img-builder --use --platform windows/amd64 docker buildx build --platform windows/amd64 --output=type=registry -f UET/Lib/Uefs/Kubernetes/Dockerfile -t "ghcr.io/redpointgames/uet/uefs:${env:UET_PACKAGE_VERSION}" --build-arg UET_TARGET_FRAMEWORK=${{ env.UET_FRAMEWORK_TARGET }} . docker buildx build --platform windows/amd64 --output=type=registry -f UET/Lib/Uefs/Kubernetes/Dockerfile -t "ghcr.io/redpointgames/uet/uefs:latest" --build-arg UET_TARGET_FRAMEWORK=${{ env.UET_FRAMEWORK_TARGET }} . + + publish-uet-container: + name: "Publish UET Container" + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + needs: + - timestamp + - libs-win + - libs-mac + - uefs-win + - uefs-mac + - shim-win + - shim-mac + - shim-linux + - pass-2-win + - pass-2-mac + - pass-2-linux + env: + UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download Linux Pass 2 + uses: ./.github/actions/download-artifact + with: + UET_ARTIFACT_NAME: pass-2-linux + UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} + - name: Log in to the Container registry + if: github.ref == 'refs/heads/main' + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build UET Container + if: github.ref != 'refs/heads/main' + shell: pwsh + run: | + docker buildx create --name img-builder-linux --use --platform linux/amd64 + docker buildx build --platform linux/amd64 --output=type=image -f UET/Lib/Container/linux.Dockerfile -t "ghcr.io/redpointgames/uet/uet:${env:UET_PACKAGE_VERSION}" --build-arg UET_TARGET_FRAMEWORK=${{ env.UET_FRAMEWORK_TARGET }} . + docker buildx build --platform linux/amd64 --output=type=image -f UET/Lib/Container/linux.Dockerfile -t "ghcr.io/redpointgames/uet/uet:latest" --build-arg UET_TARGET_FRAMEWORK=${{ env.UET_FRAMEWORK_TARGET }} . + - name: Publish UET Container + if: github.ref == 'refs/heads/main' + shell: pwsh + run: | + docker buildx create --name img-builder-linux --use --platform linux/amd64 + docker buildx build --platform linux/amd64 --output=type=registry -f UET/Lib/Container/linux.Dockerfile -t "ghcr.io/redpointgames/uet/uet:${env:UET_PACKAGE_VERSION}" --build-arg UET_TARGET_FRAMEWORK=${{ env.UET_FRAMEWORK_TARGET }} . + docker buildx build --platform linux/amd64 --output=type=registry -f UET/Lib/Container/linux.Dockerfile -t "ghcr.io/redpointgames/uet/uet:latest" --build-arg UET_TARGET_FRAMEWORK=${{ env.UET_FRAMEWORK_TARGET }} . diff --git a/UET/Lib/Container/linux.Dockerfile b/UET/Lib/Container/linux.Dockerfile new file mode 100644 index 00000000..86c72c76 --- /dev/null +++ b/UET/Lib/Container/linux.Dockerfile @@ -0,0 +1,10 @@ +FROM ubuntu:latest + +ARG UET_TARGET_FRAMEWORK + +WORKDIR /srv + +ADD UET/uet/bin/Release/${UET_TARGET_FRAMEWORK}/linux-x64/publish/uet /usr/bin/uet +RUN chmod a+x /usr/bin/uet + +ENTRYPOINT [ "/usr/bin/uet" ] \ No newline at end of file diff --git a/UET/uet/Commands/Upgrade/UpgradeCommandImplementation.cs b/UET/uet/Commands/Upgrade/UpgradeCommandImplementation.cs index 30adf806..0699af4f 100644 --- a/UET/uet/Commands/Upgrade/UpgradeCommandImplementation.cs +++ b/UET/uet/Commands/Upgrade/UpgradeCommandImplementation.cs @@ -25,6 +25,10 @@ internal static string GetAssemblyPathForVersion(string version) { return Path.Combine(UetPaths.UetRootPath, version, "uet"); } + else if (OperatingSystem.IsLinux()) + { + return Path.Combine(UetPaths.UetRootPath, version, "uet"); + } else { throw new PlatformNotSupportedException(); @@ -71,6 +75,12 @@ internal static async Task PerformUpgradeAsync( baseFolder = UetPaths.UetRootPath; filename = "uet"; } + else if (OperatingSystem.IsLinux()) + { + downloadUrl = $"https://github.com/RedpointGames/uet/releases/download/{version}/uet.linux"; + baseFolder = UetPaths.UetRootPath; + filename = "uet"; + } else { throw new PlatformNotSupportedException(); diff --git a/UET/uet/UET.csproj b/UET/uet/uet.csproj similarity index 100% rename from UET/uet/UET.csproj rename to UET/uet/uet.csproj