mirror of
				https://github.com/Ed94/refactor.git
				synced 2025-11-03 15:26:14 -08:00 
			
		
		
		
	Update to scripts and readme, workflow added release publishing.
This commit is contained in:
		
							
								
								
									
										71
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										71
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -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')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user