Skip to content

Commit

Permalink
Merge pull request #21 from blinemedical/export-credentials-from-string
Browse files Browse the repository at this point in the history
Export the gst_aws_credentials_from_string method
  • Loading branch information
jawilson authored Nov 27, 2023
2 parents 9f99c1a + 87e77e5 commit 7e45a69
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 42 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'

Expand All @@ -39,7 +39,7 @@ jobs:
- name: Install AWS C++ SDK
run: |
vcpkg install aws-sdk-cpp[s3,sts] --binarysource="clear;x-gha,readwrite"
vcpkg install aws-sdk-cpp[s3,sts] --binarysource="clear;x-gha,readwrite" --triplet x64-windows
echo "CMAKE_PREFIX_PATH=$Env:VCPKG_INSTALLATION_ROOT\installed\x64-windows" | Out-File -FilePath $Env:GITHUB_ENV -Append -Encoding utf8
- name: Build Amazon-S3 Plugin
Expand All @@ -55,10 +55,22 @@ jobs:
- name: Generate NuGet packages
run: |
mkdir nupkgs
nuget.exe pack amazon-s3-gst-plugin.nuspec -Version ${{ steps.build_plugin.outputs.plugin_version }}.${{ github.run_number }} -OutputDirectory nupkgs
$version = "${{ steps.build_plugin.outputs.plugin_version }}"
if ("${{ (startsWith(github.ref, 'refs/tags/v') || ( github.event_name == 'release' && github.event.action == 'released' )) }}" -ne "true") {
$version += "-dev.${{ github.run_number }}"
}
$version += "+g${{ github.sha }}".Substring(0, 7)
nuget.exe pack Amazon-S3-Plugin.nuspec -Version $version -OutputDirectory nupkgs
- name: Upload NuGet packages
uses: actions/upload-artifact@v3
with:
name: nuget-packages
path: 'nupkgs/*.nupkg'

- name: Publish
if: startsWith(github.ref, 'refs/tags/v')
run: |
Get-ChildItem ./nupkgs -filter "*.nupkg" | foreach{
dotnet nuget push $_.FullName --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/blinemedical/index.json
Expand Down
20 changes: 20 additions & 0 deletions Amazon-S3-Plugin.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Amazon-S3-Plugin</id>
<version>$version$</version>
<description>Amazon Gstreamer S3 Plugin</description>
<authors> Thomas Goodwin, Lyra McMillan, Jeff Wilson, Sara Boule</authors>
<tags>Native, native</tags>
</metadata>
<files>
<file src="src\gstawscredentials.h" target="build\native\include" />
<file src="src\gstawscredentials.hpp" target="build\native\include" />
<file src="src\gsts3uploaderpartcache.hpp" target="build\native\include" />
<file src="build\src\gstawscredentials-1.0.lib" target="build\native\lib" />
<file src="build\src\gsts3elements.lib" target="build\native\lib" />
<file src="build\src\gstawscredentials-1.0.dll" target="runtimes\native" />
<file src="build\src\gsts3elements.dll" target="runtimes\native" />
<file src="Amazon-S3-Plugin.targets" target="build" />
</files>
</package>
24 changes: 24 additions & 0 deletions Amazon-S3-Plugin.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\native\gsts3elements.dll">
<Link>lib\gstreamer-1.0\gsts3elements.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\native\gstawscredentials-1.0.dll">
<Link>gstawscredentials-1.0.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\runtimes\native\*.dll" />
</ItemGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>gsts3elements.lib;gstawscredentials-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)native\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
</Project>
18 changes: 0 additions & 18 deletions amazon-s3-gst-plugin.nuspec

This file was deleted.

14 changes: 0 additions & 14 deletions amazon-s3-gst-plugin.targets

This file was deleted.

2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('amazon-s3-gst-plugin', 'c', 'cpp',
version : '0.2.0',
version : '0.2.1-lldc.5',
default_options : [ 'warning_level=2',
'buildtype=debugoptimized' ])

Expand Down
6 changes: 3 additions & 3 deletions src/gstawscredentials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ _gst_aws_credentials_provider_from_string(const gchar * str)
return provider;
}

static GstAWSCredentials *
_gst_aws_credentials_from_string (const gchar * str)
GstAWSCredentials *
gst_aws_credentials_from_string (const gchar * str)
{
std::string credentials_str = str;
return gst_aws_credentials_new ([credentials_str] {
Expand All @@ -182,7 +182,7 @@ _gst_aws_credentials_deserialize (GValue * value, const gchar * s)
{
GstAWSCredentials *credentials;

credentials = _gst_aws_credentials_from_string (s);
credentials = gst_aws_credentials_from_string (s);

if (credentials) {
g_value_take_boxed (value, credentials);
Expand Down
3 changes: 3 additions & 0 deletions src/gstawscredentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ GstAWSCredentials * gst_aws_credentials_copy (GstAWSCredentials * credentials);
GST_EXPORT
void gst_aws_credentials_free (GstAWSCredentials * credentials);

GST_EXPORT
GstAWSCredentials * gst_aws_credentials_from_string (const gchar * str);

GST_EXPORT
GType gst_aws_credentials_get_type (void);

Expand Down
3 changes: 1 addition & 2 deletions tests/check/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ foreach test_file : element_tests

exe = executable(test_name, test_file,
include_directories : [configinc, element_tests_includes],
dependencies : [s3elements_dep, gst_check_dep],
dependencies : [s3elements_dep, gst_check_dep, credentials_dep],
c_args : c_args,
cpp_args : cpp_args,
)
Expand All @@ -21,4 +21,3 @@ foreach test_file : element_tests
env.set('GST_DEBUG', 'check:TRACE,s3sink:TRACE')
test(test_name, exe, timeout: 3 * 60, env: env)
endforeach

19 changes: 19 additions & 0 deletions tests/check/s3sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ GST_START_TEST (test_location_property)
}
GST_END_TEST

GST_START_TEST (test_credentials_property)
{
GstElement *sink = gst_element_factory_make ("s3sink", "sink");
GstAWSCredentials *credentials = gst_aws_credentials_from_string ("access-key-id=someAccessKey|secret-access-key=someAccessSecret");

fail_if (sink == NULL);

g_object_set (sink,
"aws-credentials",
credentials,
NULL);

gst_aws_credentials_free (credentials);

gst_object_unref (sink);
}
GST_END_TEST

GST_START_TEST (test_gst_urihandler_interface)
{
GstElement *s3Sink = gst_element_make_from_uri(GST_URI_SINK, "s3://bucket/key", "s3sink", NULL);
Expand Down Expand Up @@ -821,6 +839,7 @@ s3sink_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_no_bucket_and_key_then_start_should_fail);
tcase_add_test (tc_chain, test_location_property);
tcase_add_test (tc_chain, test_credentials_property);
tcase_add_test (tc_chain, test_gst_urihandler_interface);
tcase_add_test (tc_chain, test_change_properties_after_start_should_fail);
tcase_add_test (tc_chain, test_send_eos_should_flush_buffer);
Expand Down

0 comments on commit 7e45a69

Please sign in to comment.