diff --git a/.github/workflows/OpenActive.FakeDatabase.NET.Tests.yml b/.github/workflows/OpenActive.FakeDatabase.NET.Tests.yml deleted file mode 100644 index 267414c6..00000000 --- a/.github/workflows/OpenActive.FakeDatabase.NET.Tests.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: OpenActive.FakeDatabase.NET.Tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - name: Checkout OpenActive.Server.NET - uses: actions/checkout@v2 - - name: Setup .NET Core 3.1.419 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.419 - - name: Build OpenActive.FakeDatabase.NET.Tests - run: dotnet build ./Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj --configuration Release - - name: Run OpenActive.FakeDatabase.NET.Tests - run: dotnet test ./Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj --configuration Release --no-build --verbosity normal diff --git a/.github/workflows/OpenActive.Server.NET.Tests.yml b/.github/workflows/OpenActive.Server.NET.Tests.yml deleted file mode 100644 index 2eee1409..00000000 --- a/.github/workflows/OpenActive.Server.NET.Tests.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: OpenActive.Server.NET.Tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - name: Checkout OpenActive.Server.NET - uses: actions/checkout@v2 - - name: Setup .NET Core 3.1.419 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.419 - - name: Build OpenActive.Server.NET.Tests and dependencies - run: dotnet build ./OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj --configuration Release - - name: Run OpenActive.Server.NET.Tests - run: dotnet test ./OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj --configuration Release --no-build --verbosity normal diff --git a/.github/workflows/create-dependencies-pr.yaml b/.github/workflows/create-dependencies-pr.yaml new file mode 100644 index 00000000..45fd37b7 --- /dev/null +++ b/.github/workflows/create-dependencies-pr.yaml @@ -0,0 +1,75 @@ +name: Update Dependencies + +on: + workflow_dispatch: + repository_dispatch: + types: [OpenActive.NET-update,OpenActive.DatasetSite.NET-update] + +jobs: + generate: + runs-on: ubuntu-latest + + steps: + - name: Checkout OpenActive.Server.NET + uses: actions/checkout@v2 + with: + ref: master + + - name: Setup .NET 6.0.x + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.x + + - name: Update OpenActive.NET to latest version in OpenActive.Server.NET + run: dotnet add package OpenActive.NET + working-directory: ./OpenActive.Server.NET/ + + - name: Update OpenActive.DatasetSite.NET to latest version in OpenActive.Server.NET + run: dotnet add package OpenActive.DatasetSite.NET + working-directory: ./OpenActive.Server.NET/ + + - name: Update OpenActive.NET to latest version in OpenActive.FakeDatabase.NET + run: dotnet add package OpenActive.NET + working-directory: ./Fakes/OpenActive.FakeDatabase.NET/ + + - name: Update OpenActive.NET to latest version in BookingSystem.AspNetFramework + run: dotnet add package OpenActive.NET + working-directory: ./Examples/BookingSystem.AspNetFramework/ + + - name: Update OpenActive.DatasetSite.NET to latest version in BookingSystem.AspNetFramework + run: dotnet add package OpenActive.DatasetSite.NET + working-directory: ./Examples/BookingSystem.AspNetFramework/ + + - name: git stash if material changes have not been made + # When considering whether it's worth making a PR, ignore the following: + # - Any updates to the package.json or package-lock.json files in OpenActive.DatasetSite.NET.Generator (not worth creating a PR JUST for these if the template itself has not been updated) + # git stashing if no material changes allows the next step to close the PR if one is already open + run: if [ "$(git diff --numstat | grep -vc '^.*package\.json\|.*package-lock\.json$')" -eq "0" ]; then git stash; else echo "Material changes found"; fi + working-directory: ./ + + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3 + with: + path: . + token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} + commit-message: Update dependencies + committer: openactive-bot + author: openactive-bot + signoff: false + branch: ci/update-data-models + delete-branch: true + title: 'Update dependencies' + body: | + Update to use latest version of [OpenActive.NET](https://github.com/openactive/OpenActive.NET/) and [OpenActive.DatasetSite.NET](https://github.com/openactive/OpenActive.DatasetSite.NET/) + labels: | + automated pr + team-reviewers: | + owners + maintainers + draft: false + + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/openactive-test-suite.yml b/.github/workflows/openactive-test-suite.yml index 5b44a13c..16d0fff6 100644 --- a/.github/workflows/openactive-test-suite.yml +++ b/.github/workflows/openactive-test-suite.yml @@ -4,18 +4,55 @@ on: branches: [ master ] pull_request: branches: [ master ] + jobs: + test-server: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. + - name: Setup .NET Core 3.1.419 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.419 + - name: Build OpenActive.Server.NET.Tests and dependencies + run: dotnet build ./OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj --configuration Release + - name: Run OpenActive.Server.NET.Tests + run: dotnet test ./OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj --configuration Release --no-build --verbosity normal + + test-fake-database: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. + - name: Setup .NET Core 3.1.419 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.419 + - name: Build OpenActive.FakeDatabase.NET.Tests + run: dotnet build ./Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj --configuration Release + - name: Run OpenActive.FakeDatabase.NET.Tests + run: dotnet test ./Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj --configuration Release --no-build --verbosity normal + core: + needs: + - test-server + - test-fake-database runs-on: ubuntu-latest strategy: fail-fast: false matrix: mode: ['random', 'controlled'] - profile: ['all-features', 'single-seller', 'no-payment-reconciliation', 'no-auth'] + profile: ['all-features', 'single-seller', 'no-payment-reconciliation', 'no-auth', 'no-tax-calculation', 'prepayment-always-required'] steps: - name: Checkout OpenActive.Server.NET uses: actions/checkout@v2 with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. path: server - name: Use matching coverage/* branch ${{ github.head_ref }} in OpenActive Test Suite if: ${{ startsWith(github.head_ref, 'coverage/') }} @@ -78,7 +115,11 @@ jobs: container_name: '$web' connection_string: ${{ secrets.CONFORMANCE_CERTIFICATE_BLOB_STORAGE_CONNECTION_STRING }} sync: false + framework: + needs: + - test-server + - test-fake-database runs-on: windows-2019 strategy: fail-fast: false @@ -89,7 +130,11 @@ jobs: - name: Checkout OpenActive.Server.NET uses: actions/checkout@v2 with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. path: server + - name: Remove Nerdbank.GitVersioning as it interferes with the .NET Framework build + run: del Directory.Build.props + working-directory: server - name: Use matching coverage/* branch ${{ github.head_ref }} in OpenActive Test Suite if: ${{ startsWith(github.head_ref, 'coverage/') }} id: refs @@ -135,6 +180,7 @@ jobs: with: name: framework.${{ matrix.mode }}.${{ matrix.profile }} path: ./tests/output/ + deploy-reference-implementation: # Master branch only if: ${{ github.ref == 'refs/heads/master' }} @@ -174,3 +220,80 @@ jobs: app-name: openactive-reference-implementation-auth publish-profile: ${{ secrets.AZURE_WEBAPP_AUTH_PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation package: './web-app-package/BookingSystem.AspNetCore.IdentityServer' + + publish-server: + # Master branch only + if: ${{ github.ref == 'refs/heads/master' }} + needs: + - core + - framework + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. + - name: Get current version + uses: dotnet/nbgv@master + id: nbgv + - name: Setup .NET Core 3.1.419 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.419 + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build ./OpenActive.Server.NET/OpenActive.Server.NET.csproj --configuration Release --no-restore + - name: Test + run: dotnet test ./OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj --configuration Release --no-restore --verbosity normal + - name: Pack + run: dotnet pack ./OpenActive.Server.NET/OpenActive.Server.NET.csproj --configuration Release --include-source --no-build -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + - name: Push to Nuget + if: "! contains(toJSON(github.event.commits.*.message), '[no-release]')" + run: dotnet nuget push "./OpenActive.Server.NET/**/*.nupkg" -k ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json + - name: Create Release + if: "! contains(toJSON(github.event.commits.*.message), '[no-release]')" + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.nbgv.outputs.SimpleVersion }} + release_name: Release ${{ steps.nbgv.outputs.SimpleVersion }} + body: | + This release contains minor amendments based on updates to the [OpenActive Vocabulary](https://openactive.io/ns/) (codified by the [Data Models](https://github.com/openactive/data-models)), and the latest version of the [Dataset Site Template](https://github.com/openactive/dataset-site-template). + + Published to [Nuget](https://www.nuget.org/packages/OpenActive.Server.NET/${{ steps.nbgv.outputs.SimpleVersion }}). + draft: false + prerelease: false + + publish-fake-database: + # Master branch only + if: ${{ github.ref == 'refs/heads/master' }} + needs: + - core + - framework + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. + - name: Get current version + uses: dotnet/nbgv@master + id: nbgv + - name: Setup .NET Core 3.1.419 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.419 + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build ./Fakes/OpenActive.FakeDatabase.NET/OpenActive.FakeDatabase.NET.csproj --configuration Release --no-restore + - name: Test + run: dotnet test ./Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj --configuration Release --no-restore --verbosity normal + - name: Pack + run: dotnet pack ./Fakes/OpenActive.FakeDatabase.NET/OpenActive.FakeDatabase.NET.csproj --configuration Release --include-source --no-build -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + - name: Push to Nuget + if: "! contains(toJSON(github.event.commits.*.message), '[no-release]')" + run: dotnet nuget push "./Fakes/OpenActive.FakeDatabase.NET/**/*.nupkg" -k ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..d00b3c2f --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,9 @@ + + + + + 3.5.108 + all + + + \ No newline at end of file diff --git a/Examples/BookingSystem.AspNetCore/BookingSystem.AspNetCore.csproj b/Examples/BookingSystem.AspNetCore/BookingSystem.AspNetCore.csproj index e544bc51..e02b4905 100644 --- a/Examples/BookingSystem.AspNetCore/BookingSystem.AspNetCore.csproj +++ b/Examples/BookingSystem.AspNetCore/BookingSystem.AspNetCore.csproj @@ -7,7 +7,6 @@ - diff --git a/Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj b/Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj index 01c3b2e6..e6ac0462 100644 --- a/Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj +++ b/Fakes/OpenActive.FakeDatabase.NET.Tests/OpenActive.FakeDatabase.NET.Tests.csproj @@ -10,7 +10,6 @@ - diff --git a/Fakes/OpenActive.FakeDatabase.NET/OpenActive.FakeDatabase.NET.csproj b/Fakes/OpenActive.FakeDatabase.NET/OpenActive.FakeDatabase.NET.csproj index 811b9889..4b5c36b5 100644 --- a/Fakes/OpenActive.FakeDatabase.NET/OpenActive.FakeDatabase.NET.csproj +++ b/Fakes/OpenActive.FakeDatabase.NET/OpenActive.FakeDatabase.NET.csproj @@ -33,7 +33,7 @@ - + diff --git a/OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj b/OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj index 72da39fe..7226907e 100644 --- a/OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj +++ b/OpenActive.Server.NET.Tests/OpenActive.Server.NET.Tests.csproj @@ -11,7 +11,6 @@ - diff --git a/OpenActive.Server.NET/OpenActive.Server.NET.csproj b/OpenActive.Server.NET/OpenActive.Server.NET.csproj index 00cd272f..fe4bdb6d 100644 --- a/OpenActive.Server.NET/OpenActive.Server.NET.csproj +++ b/OpenActive.Server.NET/OpenActive.Server.NET.csproj @@ -30,8 +30,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/version.json b/version.json new file mode 100644 index 00000000..5e71cfa9 --- /dev/null +++ b/version.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "0.13.0", + "publicReleaseRefSpec": [ + "^refs/heads/master$" + ], + "versionHeightOffset": -1, + "cloudBuild": { + "setVersionVariables": true, + "buildNumber": { + "enabled": true + } + } +} \ No newline at end of file