From 0da15051906207b4c7ac636990a34663bbad7c75 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 30 Mar 2023 20:14:51 -0400 Subject: [PATCH] Update to scripts and readme, workflow added release publishing. --- .github/workflows/main.yml | 71 ++++++++++++++++++++++++++++++ Readme.md | 6 +-- scripts/build.ps1 | 89 +------------------------------------- 3 files changed, 76 insertions(+), 90 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f75921b..89d7860 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,3 +82,74 @@ jobs: if (-not [string]::IsNullOrEmpty($test)) { $args += $test } & .\scripts\build.ci.ps1 debug test + + + - name: Create + shell: pwsh + run: | + New-Item -ItemType Directory -Path "./artifact" + Copy-Item "./build/refactor.exe" -Destination "./artifact/refactor.exe" + + Copy-Item "./Readme.md" -Destination "./artifact/Readme.md" + + Compress-Archive -Path "./artifact/*" -DestinationPath "./artifact/artifact.zip" + + - name: Upload artifact + uses: actions/upload-artifact@v2 + + with: + name: artifact + path: ./artifact/artifact.zip + + + release: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: artifact + path: ./artifact + + - name: Extract artifact + run: | + unzip ./artifact/artifact.zip -d ./artifact + + - name: Create GitHub release + id: create_release + uses: actions/create-release@v1 + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload refactor.exe to the release + uses: actions/upload-release-asset@v1 + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./artifact/refactor.exe + asset_name: refactor.exe + asset_content_type: application/octet-stream + + - name: Upload README to the release + uses: actions/upload-release-asset@v1 + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./artifact/README.md + asset_name: README.md + asset_content_type: text/markdown diff --git a/Readme.md b/Readme.md index 21f2482..4fdc703 100644 --- a/Readme.md +++ b/Readme.md @@ -26,8 +26,7 @@ However, the rest of the categorical keywords (word, namespace), can really be u There is no semantic awareness this is truely just a simple find and replace, but with some filters specifiable, and words/namespaces only being restricted to the rules for C/C++ identifiers (alphanumeric or underscores only) -The main benefit for using this over alts is its problably more ergonomic and performant for large refactors on libraries that -you may want to have automated in a script. +The main benefit for using this over alts is its problably more ergonomic and performant for large refactors on libraries you may want to have automated in a script. There are other programs more robust for doing that sort of thing but I was not able to find something this simple. @@ -44,6 +43,7 @@ TODO: * Possibly come up with a better name. * Test to see how much needs to be ported for other platforms (if at all) -* Setup as api. * Provide binaries in the release page for github. (debug and release builds) * Directive to ignore comments (with a way to specify the comment signature). Right now comments that meet the signature of words or namespaces are refactored. +* Provide a GUI build. +* Provide as a single-header library. diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 32de188..3885667 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -1,87 +1,2 @@ -if ( NOT_HEADLESSS ) -{ - cls -} - - -[string] $type = $null -[string] $test = $false - -foreach ( $arg in $args ) -{ - if ( $arg -eq "test" ) - { - $test = $true - } - else - { - $type = $arg - } -} - - -#region Regular Build - -write-host "Building project`n" - -$path_root = git rev-parse --show-toplevel -$path_build = Join-Path $path_root build -$path_scripts = Join-Path $path_root scripts - - -if ( -not( Test-Path $path_build ) ) -{ - $args_meson = @() - $args_meson += "setup" - $args_meson += $path_build - - Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts -} - -if ( $type ) -{ - $args_meson = @() - $args_meson += "configure" - $args_meson += $path_build - $args_meson += "--buildtype $($type)" - - Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts -} - -$args_ninja = @() -$args_ninja += "-C" -$args_ninja += $path_build - -Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root -#endregion Regular Build - - -if ( $test -eq $true ) -{ - #region Test Build - write-host "`n`nBuilding Test`n" - - # Refactor thirdparty libraries - & (Join-Path $PSScriptRoot 'refactor_and_format.ps1') - - $path_test = Join-Path $path_root test - $path_test_build = Join-Path $path_test build - - if ( -not( Test-Path $path_test_build ) ) - { - $args_meson = @() - $args_meson += "setup" - $args_meson += $path_test_build - - Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_test - } - - $args_ninja = @() - $args_ninja += "-C" - $args_ninja += $path_test_build - - write-host $args_ninja - - Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root - #endregion Test Build -} +cls +& (Join-Path $PSScriptRoot 'build.ci.ps1')