Skip to content

Commit

Permalink
✅ improve samples code testing (#136) (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kvindee authored Mar 8, 2023
1 parent acd2980 commit 908ce9b
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-sample-codes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ jobs:
run: |
mkdir "${{ github.workspace }}/localNuget"
dotnet nuget add source "${{ github.workspace }}/localNuget" -n "NugetLocal"
dotnet nuget list source
dotnet pack "src/Mindee" --version-suffix "test" -p:TargetFrameworks=${{ matrix.dotnet-version }} --output nuget
dotnet pack "src/Mindee" --version-suffix "for-sample-codes" -p:TargetFrameworks=${{ matrix.dotnet-version }} --output nuget
cd nuget
dotnet nuget push *.nupkg --source "NugetLocal"
dotnet tool install -g dotnet-script
dotnet nuget disable source nuget.org
- name: Tests sample code
run: |
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/code_samples/base.csx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env dotnet-script
#r "nuget: Mindee, 2.1.0-test"
#r "nuget: Mindee, *-*"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 7 additions & 5 deletions test_sample_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ set -e
for f in `find docs/code_samples -name "*.txt"`
do
echo $f
if echo "$f" | grep -q "custom_1.txt"
if echo "$f" | grep -q "custom_v1.txt"
then
echo "Not processed."
continue
elif echo "$f" | grep -q "default.txt"
fi

cat docs/code_samples/base.csx $f > _test.csx

if echo "$f" | grep -q "default.txt"
then
cat docs/code_samples/base.csx $f > _test.csx
sed -i "s/my-endpoint/bank_account_details/" _test.csx
sed -i "s/my-account/mindee/" _test.csx
sed -i "s/my-version/1/" _test.csx
else
cat docs/code_samples/base.csx $f > _test.csx
fi

sed -i "s/my-api-key/$1/" _test.csx
sed -i "s/\/path\/to\/the\/file.ext/tests\/resources\/pdf\/blank_1.pdf/" _test.csx

Expand Down

0 comments on commit 908ce9b

Please sign in to comment.