From a837f6689cbbe34ae8603d847651ddd6e2b73161 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Sat, 4 Oct 2025 14:09:59 +0100 Subject: [PATCH 1/4] Setup CI using GitHub actions. --- .github/workflows/build.yml | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..19f8d5a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +name: Build PixelWorld binaries + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + include: + - os: ubuntu-latest + runtime: linux-x64 + artifact-name: pixelworld-linux-x64 + - os: ubuntu-latest + runtime: linux-arm64 + artifact-name: pixelworld-linux-arm64 + - os: windows-latest + runtime: win-x64 + artifact-name: pixelworld-win-x64 + - os: windows-latest + runtime: win-arm64 + artifact-name: pixelworld-win-arm64 + - os: macos-latest + runtime: osx-x64 + artifact-name: pixelworld-osx-x64 + - os: macos-latest + runtime: osx-arm64 + artifact-name: pixelworld-osx-arm64 + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Publish + run: | + dotnet publish --configuration Release --runtime ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --output ./publish/${{ matrix.artifact-name }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact-name }} + path: ./publish/${{ matrix.artifact-name }} + retention-days: 90 \ No newline at end of file From 9994dad1062584c65a9e8fcc54af3a84cf949e6c Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Sat, 4 Oct 2025 14:24:44 +0100 Subject: [PATCH 2/4] Configure version from Directory.Build.props --- CommandLine/Program.cs | 2 +- Directory.Build.props | 9 +++++++++ PixelWorld.sln | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Directory.Build.props diff --git a/CommandLine/Program.cs b/CommandLine/Program.cs index 32adc51..03f5291 100644 --- a/CommandLine/Program.cs +++ b/CommandLine/Program.cs @@ -17,7 +17,7 @@ private static void Main(string[] args) app.Configure(config => { config.SetApplicationName("pw.exe"); - config.SetApplicationVersion("0.10"); + config.SetApplicationVersion(typeof(Program).Assembly.GetName().Version?.ToString(3) ?? "Unknown"); AddCommands(config); }); diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..483aa3b --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,9 @@ + + + + 0.5.0 + $(Version) + $(Version) + $(Version) + + diff --git a/PixelWorld.sln b/PixelWorld.sln index 021bc2b..b8f0f85 100644 --- a/PixelWorld.sln +++ b/PixelWorld.sln @@ -10,6 +10,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{986EA84F-9F5D-4D8D-9B72-F79C53DEFBA9}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + Directory.Build.props = Directory.Build.props EndProjectSection EndProject Global From 3601b81ef1e0ea0313645e35c83e912b610916d1 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Sat, 4 Oct 2025 14:25:43 +0100 Subject: [PATCH 3/4] Fix CI for rolling builds. --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19f8d5a..7e15737 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,8 +53,7 @@ jobs: - name: Publish run: | - dotnet publish --configuration Release --runtime ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --output ./publish/${{ matrix.artifact-name }} - + dotnet publish ./CommandLine/CommandLine.csproj --configuration Release --runtime ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --output ./publish/${{ matrix.artifact-name }} - name: Upload artifacts uses: actions/upload-artifact@v4 with: From 7bb6f2bda11f707347d05a00a5238c7b9547b1e2 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Sat, 4 Oct 2025 14:29:17 +0100 Subject: [PATCH 4/4] Don't include the debug PDBs in the ZIP artifacts --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e15737..8ee0b3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,8 @@ jobs: - name: Publish run: | - dotnet publish ./CommandLine/CommandLine.csproj --configuration Release --runtime ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --output ./publish/${{ matrix.artifact-name }} + dotnet publish ./CommandLine/CommandLine.csproj --configuration Release --runtime ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false --output ./publish/${{ matrix.artifact-name }} + - name: Upload artifacts uses: actions/upload-artifact@v4 with: