Skip to content

Commit

Permalink
update project
Browse files Browse the repository at this point in the history
  • Loading branch information
shad0wshayd3 committed May 11, 2024
1 parent c2e88fe commit 3cbdca4
Show file tree
Hide file tree
Showing 46 changed files with 1,806 additions and 614 deletions.
100 changes: 0 additions & 100 deletions .clang-format

This file was deleted.

15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Auto detect text files and perform LF normalization
* text=auto
*.ps1 linguist-vendored
1 change: 1 addition & 0 deletions .github/TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# PLACEHOLDER ONLY
76 changes: 76 additions & 0 deletions .github/bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#Requires -Version 7.1

try {
$repo = Resolve-Path $PSScriptRoot/../
Push-Location $repo

# test-path
$manifests = @(
"$repo/Plugin/CMakeLists.txt",
"$repo/Plugin/cmake/Plugin.h.in",
"$repo/Plugin/vcpkg.json",
"$repo/.github/TEMPLATE",
"$repo/.github/workflows/bootstrap.yml",
# duh
"$($MyInvocation.MyCommand.Path)"
)

Write-Host "Checking files..."
foreach ($file in $manifests) {
if (!(Test-Path $file)) {
throw "File not found : {$file}"
}
}
Write-Host "...Ok, all files present"


# parse repo
$author = $($env:REPO).Split('/')[0]
$project = $($env:REPO).Split('/')[1]
Write-Host "AUTHOR: $author"
Write-Host "PROJECT: $project"


# update CMakeLists.txt
Write-Host "Updating $($manifests[0])"
$cmake = [IO.File]::ReadAllText($manifests[0])
$cmake = $cmake -replace "(?<=project\(\s+\s+).*?(?=\n\s+VERSION)", "$project"
[IO.File]::WriteAllText($manifests[0], $cmake)
Write-Host "...Ok"


# update Plugin.h
Write-Host "Updating $($manifests[1])"
$plugin = [IO.File]::ReadAllText($manifests[1])
$plugin = $plugin -replace "@PluginAuthor@", $author
[IO.File]::WriteAllText($manifests[1], $plugin)
Write-Host "...Ok"


# update vcpkg.json
Write-Host "Updating $($manifests[2])"
$vcpkg = [IO.File]::ReadAllText($manifests[2]) | ConvertFrom-Json
$vcpkg.name = $project.ToLower() -replace "_", "-"
$vcpkg.homepage = "https://github.com/$($env:REPO)"
$vcpkg = $vcpkg | ConvertTo-Json -Depth 9 | ForEach-Object { $_ -replace "(?m) (?<=^(?: )*)", " " }
[IO.File]::WriteAllText($manifests[2], $vcpkg)
Write-Host "...Ok"


# remove bootstrappers
Write-Host "Removing bootstrap files..."
foreach ($file in $manifests[3..5]) {
Remove-Item $file -Force -ErrorAction:SilentlyContinue -Confirm:$false | Out-Null
}
Write-Host "...Ok"

Write-Output "SETUP_SUCCESS=true" >> $env:GITHUB_OUTPUT
}
catch {
Write-Error "...Failed: $_"
Write-Output "SETUP_SUCCESS=false" >> $env:GITHUB_OUTPUT
}
finally {
Pop-Location
exit
}
35 changes: 35 additions & 0 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto Bootstrap

on: [push]

permissions: write-all

env:
REPO: ${{ github.repository }}

jobs:
setup-project:
if: ${{ !contains (github.repository, '/BakaPluginTemplate') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check Template
id: template
shell: pwsh
run: "Write-Output 'IS_TEMPLATE=$(Test-Path ${{ github.workspace }}/.github/TEMPLATE)' >> $env:GITHUB_OUTPUT"

- name: Rename Project
id: setup
if: ${{ steps.template.outputs.IS_TEMPLATE }} == 'true'
shell: pwsh
run: "& ${{ github.workspace }}/.github/bootstrap.ps1"

- name: Check for Commit
if: ${{ steps.setup.outputs.SETUP_SUCCESS }} == 'true'
uses: EndBug/add-and-commit@v9
with:
committer_name: setup-action
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'build: initial setup'
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
paths:
- "Plugin/**"
workflow_dispatch:

jobs:
run-build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Dependencies
run: |
git submodule update --init --recursive;
vcpkg integrate install
- name: Build
run: |
Remove-Item build -Recurse -Force -ErrorAction:SilentlyContinue -Confirm:$False | Out-Null;
cmake -B build -S Plugin --preset=build-release-msvc-msvc -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake;
cmake --build build
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Release
path: build/Release
retention-days: 30
37 changes: 14 additions & 23 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
name: Scripted maintenance
name: Maintenance

on: [ push, pull_request_target ]
on: [push]

jobs:
maintenance:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: DoozyX/[email protected]
with:
ref: ${{ github.head_ref }}
source: '.'
exclude: './docs'
extensions: 'c,cc,cpp,cppm,cxx,h,hpp,hxx,inl,inc,ixx,mxx'
clangFormatVersion: 16
inplace: True

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
- uses: EndBug/add-and-commit@v9
with:
path: ${{ runner.temp }}/llvm
key: llvm-14

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Run clang-format
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format -style=file -i

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: maintenance
committer_name: clang-format
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'chore: style formatting'
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
build/
[Bb]uild/
.vs/
.vscode/
*.zip
*.timestamp
deploy-*.ps1
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "extern/CommonLibF4"]
path = extern/CommonLibF4
url = https://github.com/shad0wshayd3/CommonLibF4.git
[submodule "extern/BethesdaCMakeModules"]
path = extern/BethesdaCMakeModules
url = https://github.com/shad0wshayd3/BethesdaCMakeModules.git
[submodule "extern/DKUtil"]
path = extern/DKUtil
url = https://github.com/shad0wshayd3/DKUtil.git
Loading

0 comments on commit 3cbdca4

Please sign in to comment.