Test Code Samples #1188
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
name: Test Code Samples | |
on: | |
pull_request: | |
schedule: | |
- cron: '0 23 * * *' | |
# Allows to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Run tests | |
timeout-minutes: 30 | |
strategy: | |
max-parallel: 2 | |
matrix: | |
os: | |
- "ubuntu-22.04" | |
dotnet-version: | |
- "net6.0" | |
- "net7.0" | |
- "net8.0" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
8.0.x | |
# - uses: actions/cache@v4 | |
# with: | |
# path: ~/.nuget/packages | |
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
# restore-keys: | | |
# ${{ runner.os }}-nuget- | |
- name: Install dotnet-script | |
run: | | |
dotnet tool install -g dotnet-script | |
- name: Create local NuGet source | |
run: | | |
mkdir "${{ github.workspace }}/nuget_local" | |
dotnet nuget add source "${{ github.workspace }}/nuget_local" -n "NugetLocal" | |
- name: Set the Version | |
run: | | |
VERSION=99.99.99 | |
sed -i "s/<VersionPrefix>[0-9.]*<\/VersionPrefix>/<VersionPrefix>$VERSION<\/VersionPrefix>/g" Directory.Build.props | |
sed -i "s/\*-\*/$VERSION/g" docs/code_samples/base.csx | |
- name: Publish Locally | |
run: | | |
dotnet pack "src/Mindee" -p:TargetFrameworks=${{ matrix.dotnet-version }} --output ./dist | |
cd ./dist | |
dotnet nuget push *.nupkg --source "NugetLocal" | |
- name: Tests sample code | |
run: | | |
./tests/test_code_samples.sh ${{ secrets.MINDEE_ACCOUNT_SE_TESTS }} ${{ secrets.MINDEE_ENDPOINT_SE_TESTS }} ${{ secrets.MINDEE_API_KEY_SE_TESTS }} |