Add tests for storage URI format #145
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
paths-ignore: | |
- '*.md' | |
- 'docs/**' | |
- '.github/workflows/purge-packages.yml' | |
pull_request: | |
paths-ignore: | |
- '*.md' | |
- 'docs/**' | |
- '.github/workflows/purge-packages.yml' | |
merge_group: | |
jobs: | |
init: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.resolve-version.outputs.version }} | |
publish-nuget-org: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
publish-github: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dotnet-gitversion | |
run: | | |
echo ":/github/home/.dotnet/tools" >> $GITHUB_PATH | |
dotnet tool install -g GitVersion.Tool --version "5.12.0" --ignore-failed-sources | |
shell: bash | |
- name: Resolve Version | |
id: resolve-version | |
shell: pwsh | |
working-directory: ./ | |
run: | | |
$rawVersion = dotnet-gitversion | ConvertFrom-Json | |
Write-Output $rawVersion | |
$semVer = $rawVersion.SemVer | |
Write-Output "Resolved version $semVer" | |
Write-Output "version=$semVer" >> $env:GITHUB_OUTPUT | |
Write-Output "Version = $semVer" >> $env:GITHUB_STEP_SUMMARY | |
build: | |
runs-on: ubuntu-latest | |
needs: init | |
env: | |
Configuration: Release | |
TreatWarningsAsErrors: true | |
Version: ${{ needs.init.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Restore | |
run: dotnet restore | |
- name: Check Format | |
run: dotnet format --no-restore --verify-no-changes | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-restore | |
working-directory: ./tests/Tests | |
- name: Pack | |
run: dotnet pack --no-build -o nugets/ | |
- name: Validate NuGets | |
run: | | |
echo ':/github/home/.dotnet/tools' >> $env:GITHUB_PATH | |
dotnet tool install -g dotnet-validate --version '0.0.1-preview.304' --ignore-failed-sources | |
Get-ChildItem ./nugets -Filter '*.nupkg' | ForEach-Object { dotnet-validate package local $_ } | |
shell: pwsh | |
- name: Upload Nugets as Artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ needs.init.outputs.publish-nuget-org == 'true' || needs.init.outputs.publish-github == 'true'}} | |
with: | |
name: nugets | |
path: nugets | |
test-with-azure-infra: | |
runs-on: ubuntu-latest | |
environment: azure | |
if: ${{ github.secret_source == 'Actions' }} | |
permissions: | |
contents: read | |
id-token: write | |
env: | |
Configuration: Release | |
TreatWarningsAsErrors: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: azure/login@v2 | |
with: | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- run: dotnet test | |
env: | |
SPOTFLOW_USE_AZURE: true | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
AZURE_RESOURCE_GROUP_NAME: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} | |
AZURE_STORAGE_ACCOUNT_NAME: ${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }} | |
AZURE_SERVICE_BUS_NAMESPACE_NAME: ${{ secrets.AZURE_SERVICE_BUS_NAMESPACE_NAME }} | |
AZURE_KEY_VAULT_NAME: ${{ secrets.AZURE_KEY_VAULT_NAME }} | |
AZURE_EVENT_HUB_NAMESPACE_NAME: ${{ secrets.AZURE_EVENT_HUB_NAMESPACE_NAME }} | |
publish-nuget-org: | |
runs-on: ubuntu-latest | |
needs: [init, build, test-with-azure-infra] | |
if: ${{ needs.init.outputs.publish-nuget-org == 'true' }} | |
environment: nuget-org | |
steps: | |
- name: Download Nugets | |
uses: actions/download-artifact@v4 | |
with: | |
name: nugets | |
- name: Push Nugets | |
run: dotnet nuget push '*.nupkg' --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
publish-github: | |
runs-on: ubuntu-latest | |
needs: [init, build, test-with-azure-infra] | |
permissions: | |
packages: write | |
if: ${{ needs.init.outputs.publish-github == 'true' }} | |
steps: | |
- name: Download Nugets | |
uses: actions/download-artifact@v4 | |
with: | |
name: nugets | |
- name: Push Nugets | |
run: dotnet nuget push '*.nupkg' --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/spotflow-io/index.json --skip-duplicate |