33 Commits

Author SHA1 Message Date
Ed_
bdc272cc2b Added release tag.. 2023-03-30 22:41:46 -04:00
Ed_
8d5cdec586 ok 2023-03-30 22:34:32 -04:00
Ed_
1d807eaf0a Another release attempt 2023-03-30 22:31:07 -04:00
Ed_
2fe7ded7ec Ok. 2023-03-30 21:58:31 -04:00
Ed_
1f2d3cdd42 Attempt to add release versioning again... 2023-03-30 21:53:24 -04:00
Ed_
03f5441b25 Attempting to use avakar's release action 2023-03-30 21:37:53 -04:00
Ed_
b05ee03609 Workflow: Remove step "Create GitHub release" 2023-03-30 21:21:31 -04:00
Ed_
e30539fe32 Workflow : Removing body file. 2023-03-30 21:14:24 -04:00
Ed_
935bfe63ad Hopefully workflow works. 2023-03-30 21:07:10 -04:00
Ed_
d95d4a8d06 Attempting workflow error fix. 2023-03-30 20:50:31 -04:00
Ed_
7d7c34d157 Update release name to just use commit #. 2023-03-30 20:47:25 -04:00
Ed_
25df998dc2 Remove the readme upload. 2023-03-30 20:44:57 -04:00
Ed_
9479a28282 Change workflow release tag name and release_name 2023-03-30 20:40:56 -04:00
Ed_
0246b8419a Fixed workflow error with readme upload. 2023-03-30 20:35:31 -04:00
Ed_
0da1505190 Update to scripts and readme, workflow added release publishing. 2023-03-30 20:14:51 -04:00
Ed_
d73d22282b Some code cleanup 2023-03-30 19:54:19 -04:00
Ed_
78cdfcd7b3 Made a separate build script for CI. 2023-03-30 19:43:44 -04:00
Ed_
018286be6f Some refinement to the gh-workflow 2023-03-30 19:34:07 -04:00
Ed_
a0a3e42e6a Various updates to scripts 2023-03-30 19:33:46 -04:00
Ed_
f9b8f02351 Corrections to debug code for release builds. 2023-03-30 19:33:35 -04:00
Ed_
5bfa8395db Fixing issue with build script not being able to find refactor script in gh-actions. 2023-03-30 18:50:45 -04:00
Ed_
048fcac1bf Bloat.cpp: Bad static on Global_Arena 2023-03-30 18:46:22 -04:00
Ed_
eccbdac3b2 Powershell is dumb 2023-03-30 18:43:22 -04:00
Ed_
2933393f55 Still dumb 2023-03-30 18:39:39 -04:00
Ed_
61880e8dee I'm dumb 2023-03-30 18:37:01 -04:00
Ed_
9bf6af8ce5 Fix issue with cls command on gh-actions. 2023-03-30 18:34:55 -04:00
Ed_
20dd92a684 Possible fix for gh-action yml error. 2023-03-30 18:32:33 -04:00
Ed_
be6b37ae00 attempting to just run the pwsh script with just hardcoded command. 2023-03-30 18:31:41 -04:00
Ed_
e867768862 GH-Actions: Installing meson with pip instead. 2023-03-30 18:28:06 -04:00
Ed_
b08ff787a8 Switching to chocolately as for some reason gh-actions doesn't support winget... 2023-03-30 18:20:33 -04:00
Ed_
263fa66f7f GH-Actions: Using winget instead, win-server 2019. 2023-03-30 18:13:45 -04:00
Ed_
6e9d35cb37 Attempt to fix issue with scoop usage in admin mode. 2023-03-30 18:08:33 -04:00
Ed_
2176314adf Merge pull request #3 from Ed94/build_workflow
Create main.yml
2023-03-30 18:04:00 -04:00
10 changed files with 181 additions and 128 deletions

View File

@ -1,43 +1,76 @@
# Name of the workflow
name: Build
# Events used by github actions to know when to execute this workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
type:
description: 'Meson buildtype (release, debug, etc.)'
required: false
test:
description: 'Run tests (test)'
required: false
jobs:
build:
runs-on: windows-latest
runs-on:
windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install Meson, Ninja, and Clang with Scoop
- name: Install Meson, Ninja, and Clang with Chocolatey and pip
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
scoop install meson ninja llvm
if (-not (Get-Command choco -ErrorAction SilentlyContinue))
{
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
if (-not (choco list --local-only | Select-String "python"))
{
choco install -y python
}
if (-not (choco list --local-only | Select-String "ninja"))
{
choco install -y ninja
}
if (-not (choco list --local-only | Select-String "llvm"))
{
choco install -y llvm
}
python -m pip install meson
- name: Run PowerShell build script
shell: pwsh
env:
CC: clang
CXX: clang++
BUILD_TYPE: ${{ github.event.inputs.type }}
RUN_TESTS: ${{ github.event.inputs.test }}
run: |
$ErrorActionPreference = "Stop"
@ -48,4 +81,28 @@ jobs:
if (-not [string]::IsNullOrEmpty($type)) { $args += $type }
if (-not [string]::IsNullOrEmpty($test)) { $args += $test }
& .\scripts\build.ps1 @args
& .\scripts\build.ci.ps1 debug test
- name: Get Short Commit SHA
shell: pwsh
run: |
$shortSHA = $env:github_sha.Substring(0, 7)
echo "Short SHA: $shortSHA"
echo "SHORT_SHA=$shortSHA" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Create Package
shell: pwsh
run: |
New-Item -ItemType Directory -Path "./artifact"
Copy-Item "./build/refactor.exe" -Destination "./artifact/refactor.exe"
Compress-Archive -Path "./artifact/*" -DestinationPath "./artifact/refactor-${env:SHORT_SHA}.zip"
- name: Upload Release
uses: ncipollo/release-action@v1
with:
tag: Release
artifacts: ./artifact/refactor-${env:SHORT_SHA}.zip
omitBody: true
# bodyFile: "body.md"
allowUpdates: true

View File

@ -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.

View File

@ -1,11 +1,14 @@
#define BLOAT_IMPL
#include "Bloat.hpp"
namespace Global
{
bool ShouldShowDebug = false;
}
namespace Memory
{
static zpl_arena Global_Arena {};
zpl_arena Global_Arena {};
void setup()
{

View File

@ -8,14 +8,6 @@
# define ZPL_IMPLEMENTATION
#endif
#if __clang__
# pragma clang diagnostic ignored "-Wunused-const-variable"
# pragma clang diagnostic ignored "-Wswitch"
# pragma clang diagnostic ignored "-Wunused-variable"
#endif
#pragma region ZPL INCLUDE
#if __clang__
# pragma clang diagnostic push
@ -48,6 +40,15 @@
#if __clang__
# pragma clang diagnostic ignored "-Wunused-const-variable"
# pragma clang diagnostic ignored "-Wswitch"
# pragma clang diagnostic ignored "-Wunused-variable"
# pragma clang diagnostic ignored "-Wunknown-pragmas"
#endif
#define bit( Value_ ) ( 1 << Value_ )
#define bitfield_is_equal( Field_, Mask_ ) ( ( Mask_ & Field_ ) == Mask_ )
#define ct constexpr
@ -88,6 +89,11 @@ using Array_Line = zpl_array( Line );
ct char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
namespace Global
{
extern bool ShouldShowDebug;
}
namespace Memory
{
ct uw Initial_Reserve = zpl_megabytes(2);
@ -103,10 +109,13 @@ namespace Memory
// Had to be made to support multiple sub-arguments per "opt" argument.
b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv);
inline
sw log_fmt(char const *fmt, ...)
{
#if Build_Debug
if ( Global::ShouldShowDebug == false )
return 0;
sw res;
va_list va;
@ -115,10 +124,6 @@ sw log_fmt(char const *fmt, ...)
va_end(va);
return res;
#else
return 0;
#endif
}
inline

View File

@ -142,9 +142,6 @@ namespace Spec
bool ignore = false;
Entry entry {};
log_fmt("\nIGNORE WORD COUNT: %d", zpl_array_count(Ignore_Words));
// Find a valid token
find_next_token( type, token, line, length );
@ -327,15 +324,5 @@ namespace Spec
}
}
while ( lines++, left--, left > 0 );
Spec::Entry* ignore = Spec::Ignore_Words;
sw ignores_left = zpl_array_count( Spec::Ignore_Words);
zpl_printf("\nIgnores: ");
for ( ; ignores_left; ignores_left--, ignore++ )
{
zpl_printf("\n%s", ignore->Sig);
}
zpl_printf("\n");
}
}

View File

@ -3,6 +3,7 @@
#include "Spec.cpp"
void parse_options( int num, char** arguments )
{
zpl_opts opts;
@ -12,22 +13,22 @@ void parse_options( int num, char** arguments )
zpl_opts_add( & opts, "dst" , "dst" , "File/s post refactor" , ZPL_OPTS_STRING);
zpl_opts_add( & opts, "spec", "spec", "Specification for refactoring", ZPL_OPTS_STRING);
#if Build_Debug
zpl_opts_add( & opts, "debug", "debug", "Allows for wait to attach", ZPL_OPTS_FLAG);
#endif
if (opts_custom_compile( & opts, num, arguments))
{
sw num = 0;
#if Build_Debug
if ( zpl_opts_has_arg( & opts, "debug" ) )
{
#if Build_Debug
zpl_printf("Will wait (pause available for attachment)");
char pause = getchar();
}
#endif
Global::ShouldShowDebug = true;
}
if ( zpl_opts_has_arg( & opts, "num" ) )
{
num = zpl_opts_integer( & opts, "num", -1 );
@ -49,8 +50,6 @@ void parse_options( int num, char** arguments )
zpl_array_init_reserve( IO::Destinations, g_allocator, 1 );
}
zpl_printf("NUM IS: %d", num);
if ( zpl_opts_has_arg( & opts, "src" ) )
{
zpl_string opt = zpl_opts_string( & opts, "src", "INVALID SRC ARGUMENT" );
@ -589,10 +588,6 @@ void refactor()
}
move_forward( 1 );
// zpl_string_clear( preview );
// preview = zpl_string_append_length( preview, src, 100);
// log_fmt( "__PREVIEW: %d \nn%s\n\n__PREVIEW_END", left, preview );
}
while ( left );
End_Search:

81
scripts/build.ci.ps1 Normal file
View File

@ -0,0 +1,81 @@
[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
}

View File

@ -1,80 +1,2 @@
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
& .\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
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_test
#endregion Test Build
}
& (Join-Path $PSScriptRoot 'build.ci.ps1')

View File

@ -18,4 +18,7 @@ if ( Test-Path $path_test_build )
$files = Get-ChildItem -Recurse -Path $path_test -Include $include -Exclude $exclude
if ( $files )
{
Remove-Item $files
}

View File

@ -46,7 +46,7 @@ if ( $false ){
}
else {
$refactorParams = @(
"-debug",
# "-debug",
"-num=$($targetFiles.Count)"
"-src=$($targetFiles)",
"-dst=$($refactoredFiles)",
@ -86,7 +86,7 @@ foreach ( $file in $targetFiles )
}
$refactorParams = @(
"-debug",
# "-debug",
"-num=$($targetFiles.Count)"
"-src=$($targetFiles)",
"-dst=$($refactoredFiles)",