From 39fc98eacca3146736cf35cee96684209a6ae154 Mon Sep 17 00:00:00 2001 From: Aptivi Date: Thu, 18 Apr 2024 16:32:59 +0300 Subject: [PATCH] Updated Makefiles and workflows as appropriate --- .github/workflows/build-rel.yml | 26 +++++++++++-------- .github/workflows/build.yml | 26 +++++++++++-------- .github/workflows/docgen.yml | 6 ++--- .github/workflows/pack.yml | 2 +- .github/workflows/prepdraft.yml | 45 ++++++++++++++++----------------- Makefile | 6 +++++ tools/Makefile | 6 ++++- tools/pack.cmd | 20 --------------- tools/pack.sh | 30 ---------------------- 9 files changed, 66 insertions(+), 101 deletions(-) delete mode 100644 tools/pack.cmd delete mode 100644 tools/pack.sh diff --git a/.github/workflows/build-rel.yml b/.github/workflows/build-rel.yml index 5a1b10f..a5d22e6 100644 --- a/.github/workflows/build-rel.yml +++ b/.github/workflows/build-rel.yml @@ -16,15 +16,19 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Solution Compilation - run: dotnet build --configuration Release - - name: Testing - run: dotnet test --no-build --configuration Release + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Solution Compilation (Windows) + if: matrix.runs-on == 'windows-latest' + run: cd tools ; ./build.cmd ; cd .. + - name: Solution Compilation (Unix) + if: matrix.runs-on != 'windows-latest' + run: make + - name: Testing + run: dotnet test --no-build --configuration Release diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2901d9a..9e1d3d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,15 +16,19 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Solution Compilation - run: dotnet build --configuration Debug - - name: Testing - run: dotnet test --no-build --configuration Debug + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Solution Compilation (Windows) + if: matrix.runs-on == 'windows-latest' + run: cd tools ; ./build.cmd Debug ; cd .. + - name: Solution Compilation (Unix) + if: matrix.runs-on != 'windows-latest' + run: make dbg + - name: Testing + run: dotnet test --no-build --configuration Debug diff --git a/.github/workflows/docgen.yml b/.github/workflows/docgen.yml index 01a74dd..5a36795 100644 --- a/.github/workflows/docgen.yml +++ b/.github/workflows/docgen.yml @@ -21,10 +21,8 @@ jobs: dotnet-version: '8.0.x' - name: Setup DocFX run: dotnet tool install --global docfx - - name: Solution Compilation - run: dotnet build --configuration Release - - name: Generating documentation - run: docfx DocGen/docfx.json + - name: Generating Documentation + run: make doc - name: Saving changes to gh-pages uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml index 3cf1e92..fa15fe6 100644 --- a/.github/workflows/pack.yml +++ b/.github/workflows/pack.yml @@ -18,7 +18,7 @@ jobs: with: dotnet-version: '8.0.x' - name: Solution Compilation - run: dotnet build --configuration Release + run: make - name: Package Publication run: dotnet nuget push "VisualCard/bin/Release/*.nupkg" --api-key ${{ secrets.NUGET_APIKEY }} --source "nuget.org" diff --git a/.github/workflows/prepdraft.yml b/.github/workflows/prepdraft.yml index e83897b..bfeb5e4 100644 --- a/.github/workflows/prepdraft.yml +++ b/.github/workflows/prepdraft.yml @@ -8,29 +8,28 @@ on: jobs: build: - runs-on: windows-latest + runs-on: ubuntu-latest permissions: contents: write steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Setup DocFX - run: dotnet tool install --global docfx - - name: Release Asset Preparation - run: | - cd tools ; ./build.cmd ; cd .. - cd tools ; ./pack.cmd ; cd .. - cd tools ; ./docgen.cmd ; cd .. - cd tools ; ./docgen-pack.cmd ; cd .. - - name: Release Draft Making - uses: softprops/action-gh-release@v1 - with: - body: "This is a draft release. Fill this with a release snippet from the release sheet made internally." - draft: true - files: | - tools/*.zip + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Setup DocFX + run: dotnet tool install --global docfx + - name: Release Asset Preparation + run: | + chmod +x tools/*.sh + make doc + cd tools ; ./docgen-pack.sh ; cd .. + - name: Release Draft Making + uses: softprops/action-gh-release@v1 + with: + body: "This is a draft release. Fill this with a release snippet from the release sheet made internally." + draft: true + files: | + tools/*.zip diff --git a/Makefile b/Makefile index 842db92..c205a9d 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,12 @@ all: all-online all-online: $(MAKE) -C tools invoke-build +dbg: + $(MAKE) -C tools invoke-build ENVIRONMENT=Debug + +doc: + $(MAKE) -C tools invoke-doc-build + clean: rm -rf $(OUTPUTS) diff --git a/tools/Makefile b/tools/Makefile index 77bbf99..1c31ba0 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -6,4 +6,8 @@ DOTNET_HEAP_LIMIT = $(shell printf '%X\n' $$(($(DOTNET_AVPHYS_PAGES) * $(DOTNET_ invoke-build: chmod +x ./build.sh - ./build.sh || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./build.sh) + ./build.sh $(ENVIRONMENT) || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./build.sh $(ENVIRONMENT)) + +invoke-doc-build: invoke-build + chmod +x ./docgen.sh + ./docgen.sh || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./docgen.sh) diff --git a/tools/pack.cmd b/tools/pack.cmd deleted file mode 100644 index be7e97a..0000000 --- a/tools/pack.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -for /f "tokens=* USEBACKQ" %%f in (`type version`) do set version=%%f -set releaseconfig=%1 -if "%releaseconfig%" == "" set releaseconfig=Release - -:packbin -echo Packing binary... -"%ProgramFiles%\7-Zip\7z.exe" a -tzip %temp%/%version%-bin.zip "..\VisualCard\bin\%releaseconfig%\netstandard2.0\*" -"%ProgramFiles%\7-Zip\7z.exe" a -tzip %temp%/%version%-demo.zip "..\VisualCard.ShowContacts\bin\%releaseconfig%\net8.0\*" -if %errorlevel% == 0 goto :complete -echo There was an error trying to pack binary (%errorlevel%). -goto :finished - -:complete -move %temp%\%version%-bin.zip -move %temp%\%version%-demo.zip - -echo Pack successful. -:finished diff --git a/tools/pack.sh b/tools/pack.sh deleted file mode 100644 index 030c5ca..0000000 --- a/tools/pack.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# This script builds and packs the artifacts. Use when you have MSBuild installed. -version=$(cat version) -releaseconf=$1 -if [ -z $releaseconf ]; then - releaseconf=Release -fi - -# Check for dependencies -zippath=`which zip` -if [ ! $? == 0 ]; then - echo zip is not found. - exit 1 -fi - -# Pack binary -echo Packing binary... -cd "../VisualCard/bin/$releaseconf/netstandard2.0/" && "$zippath" -r /tmp/$version-bin.zip . && cd - -cd "../VisualCard.ShowContacts/bin/$releaseconf/net8.0/" && "$zippath" -r /tmp/$version-bin.zip . && cd - -if [ ! $? == 0 ]; then - echo Packing using zip failed. - exit 1 -fi - -# Inform success -mv ~/tmp/$version-bin.zip . -mv ~/tmp/$version-demo.zip . -echo Build and pack successful. -exit 0