-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up NuGet packages and related CI infrastructure.
Related changes: * Updated to ClangSharp.Pathogen 0.0.0 (which is published on NuGet.org.) * Biohazrd is no longer marked as x64-only. * This restriction was in place primarily because ClangSharp.Pathogen only provides x64 matrix runtimes. While this is still true, nothing about Biohazrd its self is x64-only, and advanced users can manually provide their own libclang-pathogen for their platform as necessary. Closes #214
- Loading branch information
1 parent
ad822e7
commit 20e2099
Showing
15 changed files
with
390 additions
and
14 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
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,88 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import re | ||
|
||
import gha | ||
|
||
#================================================================================================== | ||
# Get inputs | ||
#================================================================================================== | ||
def get_environment_variable(name): | ||
ret = os.getenv(name) | ||
|
||
if ret is None: | ||
gha.print_error(f"Missing required parameter '{name}'") | ||
|
||
if (ret == ''): | ||
return None | ||
|
||
return ret | ||
|
||
github_event_name = get_environment_variable('github_event_name') | ||
github_run_number = get_environment_variable('github_run_number') | ||
github_ref = get_environment_variable('github_ref') | ||
|
||
#================================================================================================== | ||
# Determine build settings | ||
#================================================================================================== | ||
|
||
# For GitHub refs besides main, include the branch/tag name in the default version string | ||
ref_part = '' | ||
if github_ref != 'refs/heads/main': | ||
ref = github_ref | ||
|
||
# Strip the ref prefix | ||
branch_prefix = 'refs/heads/' | ||
tag_prefix = 'refs/tags/' | ||
if ref.startswith(branch_prefix): | ||
ref = ref[len(branch_prefix):] | ||
elif ref.startswith(tag_prefix): | ||
ref = f'tag-{ref[len(tag_prefix):]}' | ||
|
||
# Replace illegal characters with dashes | ||
ref = re.sub('[^0-9A-Za-z-]', '-', ref) | ||
|
||
# Make the ref part | ||
ref_part = f'-{ref}' | ||
|
||
# Build the default version string | ||
version = f'0.0.0{ref_part}-ci{github_run_number}' | ||
is_for_release = False | ||
|
||
# Handle non-default version strings | ||
# Make sure logic relating to is_for_release matches the publish-packages-nuget-org in the workflow | ||
if github_event_name == 'release': | ||
version = get_environment_variable('release_version') | ||
is_for_release = True | ||
elif github_event_name == 'workflow_dispatch': | ||
workflow_dispatch_version = get_environment_variable('workflow_dispatch_version') | ||
workflow_dispatch_will_publish_packages = get_environment_variable('workflow_dispatch_will_publish_packages') | ||
|
||
if workflow_dispatch_version is not None: | ||
version = workflow_dispatch_version | ||
|
||
if workflow_dispatch_will_publish_packages.lower() == 'true': | ||
is_for_release = True | ||
|
||
# Trim leading v off of version if present | ||
if version.startswith('v'): | ||
version = version[1:] | ||
|
||
# Validate the version number | ||
if not re.match('^\d+\.\d+\.\d+(-[0-9a-zA-Z.-]+)?$', version): | ||
gha.print_error(f"'{version}' is not a valid semver version!") | ||
|
||
# If there are any errors at this point, make sure we exit with an error code | ||
gha.fail_if_errors() | ||
|
||
#================================================================================================== | ||
# Emit MSBuild properties | ||
#================================================================================================== | ||
print(f"Configuring build environment to build{' and release' if is_for_release else ''} version {version}") | ||
gha.set_environment_variable('CiBuildVersion', version) | ||
gha.set_environment_variable('CiIsForRelease', str(is_for_release).lower()) | ||
|
||
#================================================================================================== | ||
# Final check to exit with an error code if any errors were printed | ||
#================================================================================================== | ||
gha.fail_if_errors() |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.vs/ | ||
bin/ | ||
obj/ | ||
/packages/ |
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,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
|
||
<!-- | ||
This package is just a convenience package which brings in all the other components of Biohazrd. | ||
It does not contain code. | ||
--> | ||
<PackageId>Biohazrd</PackageId> | ||
<IncludeBuildOutput>false</IncludeBuildOutput> | ||
<IncludeSymbols>false</IncludeSymbols> | ||
|
||
<!-- | ||
This warning basically happens because this package has no assemblies but does have dependencies | ||
https://github.com/NuGet/Home/issues/8583 | ||
--> | ||
<NoWarn>$(NoWarn);NU5128</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Biohazrd.CSharp\Biohazrd.CSharp.csproj" /> | ||
<ProjectReference Include="..\Biohazrd.OutputGeneration\Biohazrd.OutputGeneration.csproj" /> | ||
<ProjectReference Include="..\Biohazrd.Transformation\Biohazrd.Transformation.csproj" /> | ||
<ProjectReference Include="..\Biohazrd.Utilities\Biohazrd.Utilities.csproj" /> | ||
<ProjectReference Include="..\Biohazrd\Biohazrd.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
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
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
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
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
Oops, something went wrong.