-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major refactor to improve performance and remove technical debt
- Loading branch information
Showing
51 changed files
with
3,452 additions
and
3,180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
BasedOnStyle: Google | ||
IndentWidth: 4 | ||
ColumnLimit: 120 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Build Plugin Dev Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
|
||
env: | ||
DLL_NAME: vACDM.dll | ||
BUILD_CONFIGURATION: Release | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: "0" | ||
DEV_RELEASE: "-1" | ||
|
||
jobs: | ||
formatting-check: | ||
uses: ./.github/workflows/clang-format.yml | ||
|
||
build: | ||
needs: formatting-check | ||
runs-on: windows-latest | ||
name: "Build plugin" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install PyGithub | ||
- name: Run version handler | ||
env: | ||
REPOSITORY: ${{ github.repository }} | ||
REF: ${{ github.ref }} | ||
run: | | ||
python .github/workflows/version_handler.py | ||
- name: Determine DEV_RELEASE value | ||
id: find_latest_dev_release | ||
env: | ||
REPOSITORY: ${{ github.repository }} | ||
run: python .github/workflows/determine_dev_release.py | ||
|
||
- name: Install MSVC toolset | ||
run: choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" | ||
|
||
- name: Set up MSVC environment | ||
shell: pwsh | ||
run: | | ||
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | ||
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools" | ||
- name: Configure CMake | ||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_CONFIGURATION}} -A Win32 -DDEV_BUILD=ON -DDEV_RELEASE_NUMBER="${{ env.DEV_RELEASE }}" | ||
|
||
- name: Build DLL | ||
run: cmake --build build --config ${{env.BUILD_CONFIGURATION}} | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: v${{ env.VERSION }} | ||
release_name: v${{ env.VERSION }} | ||
draft: true # to allow amendment of release notes | ||
prerelease: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload release asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: build/${{env.BUILD_CONFIGURATION}}/${{env.DLL_NAME}} | ||
asset_name: ${{env.DLL_NAME}} | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload config file (vacdm.txt) | ||
id: upload-release-asset-txt | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: src/config/vacdm.txt | ||
asset_name: vacdm.txt | ||
asset_content_type: text/plain | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Build Plugin Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
DLL_NAME: vACDM.dll | ||
BUILD_CONFIGURATION: Release | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: "0" | ||
|
||
jobs: | ||
formatting-check: | ||
uses: ./.github/workflows/clang-format.yml | ||
|
||
build: | ||
needs: formatting-check | ||
runs-on: windows-latest | ||
name: "Build plugin" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install MSVC toolset | ||
run: choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install PyGithub | ||
- name: Run version handler | ||
env: | ||
REPOSITORY: ${{ github.repository }} | ||
REF: ${{ github.ref }} | ||
run: | | ||
python .github/workflows/version_handler.py | ||
- name: Set up MSVC environment | ||
shell: pwsh | ||
run: | | ||
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | ||
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools" | ||
- name: Configure CMake | ||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_CONFIGURATION}} -A Win32 | ||
|
||
- name: Build DLL | ||
run: cmake --build build --config ${{env.BUILD_CONFIGURATION}} | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: v${{ env.VERSION }} | ||
release_name: v${{ env.VERSION }} | ||
draft: true # to allow amendment of release notes | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload release asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: build/${{env.BUILD_CONFIGURATION}}/${{env.DLL_NAME}} | ||
asset_name: ${{env.DLL_NAME}} | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload config file (vacdm.txt) | ||
id: upload-release-asset-txt | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: src/config/vacdm.txt | ||
asset_name: vacdm.txt | ||
asset_content_type: text/plain | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: clang-format Check | ||
on: [workflow_call, pull_request] | ||
jobs: | ||
formatting-check: | ||
name: Formatting Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run clang-format style check for C/C++ programs. | ||
uses: jidicula/[email protected] | ||
with: | ||
clang-format-version: "13" | ||
check-path: "src" | ||
fallback-style: "Google" | ||
exclude-regex: "(sqlite3)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" Finds the project version defined in CMakeLists.txt""" | ||
|
||
import sys | ||
import re | ||
|
||
|
||
def extract_version_from_cmakelists(): | ||
# Define the pattern to search for in the file | ||
pattern = r'PROJECT\(.*?VERSION\s+"(\d+\.\d+\.\d+)"' | ||
|
||
# Read the contents of CMakeLists.txt | ||
with open("CMakeLists.txt", "r") as file: | ||
contents = file.read() | ||
|
||
# Search for the pattern | ||
match = re.search(pattern, contents) | ||
|
||
# If a match is found, extract the version | ||
if match: | ||
print("Found version number in CMakeLists.txt: ", match.group(1)) | ||
return match.group(1) | ||
|
||
# exit if the version could not be found | ||
print("Could not find version in CMakeLists.txt") | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import sys | ||
import re | ||
from github import Github | ||
|
||
|
||
def parse_semantic_version(version): | ||
# Parse the semantic version and extract major and minor versions | ||
match = re.match(r"v?(\d+)\.(\d+)\.(\d+)", version) | ||
if match: | ||
print(match.groups()) | ||
major, minor, patch = match.groups() | ||
return int(major), int(minor), int(patch) | ||
else: | ||
return None | ||
|
||
|
||
def find_highest_dev_release(repo, major, minor): | ||
# Initialize a GitHub instance | ||
g = Github() | ||
|
||
# Get the repository object | ||
repository = g.get_repo(repo) | ||
|
||
# Fetch all releases | ||
releases = repository.get_releases() | ||
|
||
# Filter pre-releases with matching major and minor versions in their titles | ||
pre_releases = [ | ||
release | ||
for release in releases | ||
if release.prerelease and release.title.startswith(f"v{major}.{minor}") | ||
] | ||
|
||
# Extract DEV_RELEASE numbers from titles | ||
dev_releases = [int(release.title.split(".")[-1]) for release in pre_releases] | ||
|
||
# Find the highest DEV_RELEASE number | ||
highest_dev_release = max(dev_releases, default=0) | ||
|
||
return highest_dev_release | ||
|
||
|
||
def determine_dev_release(version, repository): | ||
if version == "0": | ||
result = 0 | ||
else: | ||
# Parse the semantic version to extract major and minor versions | ||
major, minor, _ = parse_semantic_version(version) | ||
if major is not None and minor is not None: | ||
result = find_highest_dev_release(repository, major, minor) | ||
else: | ||
print("Invalid semantic version format") | ||
sys.exit(1) | ||
|
||
print("Determined dev release version as ", result) | ||
|
||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" """ | ||
|
||
import sys | ||
import os | ||
import re | ||
|
||
from cmake_project_version import extract_version_from_cmakelists | ||
from determine_dev_release import determine_dev_release | ||
|
||
REPOSITORY_NAME = os.environ.get("REPOSITORY") | ||
REF = os.environ.get("REF") | ||
|
||
# determine the branch that triggered the workflow | ||
match = re.match(r"refs/heads/(.*)", REF) | ||
if not match: | ||
sys.exit(1) | ||
|
||
branch_name = match.group(1) | ||
print("Determined branch name: ", branch_name) | ||
|
||
version = extract_version_from_cmakelists() | ||
|
||
is_dev_branch = branch_name == "develop" | ||
dev_release = None | ||
if is_dev_branch: | ||
last_dev_release = determine_dev_release(version, REPOSITORY_NAME) | ||
dev_release = str(last_dev_release + 1) | ||
version += "-dev." + dev_release | ||
|
||
# Write the version and dev release to GitHub environment variable | ||
with open(os.getenv("GITHUB_ENV"), "a") as env_file: | ||
env_file.write(f"VERSION={version}\n") | ||
if is_dev_branch and dev_release: | ||
env_file.write(f"DEV_RELEASE={dev_release}\n") |
Oops, something went wrong.