Skip to content

Commit

Permalink
fix: CI and bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nickevansuk committed Jul 19, 2022
1 parent 9797e10 commit 119c30e
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 55 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/OpenActive.FakeDatabase.NET.Tests.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/OpenActive.Server.NET.Tests.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/create-dependencies-pr.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
author: openactive-bot <[email protected]>
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 }}"
125 changes: 124 additions & 1 deletion .github/workflows/openactive-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/') }}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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' }}
Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning">
<Version>3.5.108</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.2" />
<PackageReference Include="OpenActive.NET" Version="15.2.17" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="OpenActive.NET" Version="15.2.17" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ServiceStack.OrmLite.Sqlite.Core" Version="5.11.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="OpenActive.NET" Version="15.2.17" />
<PackageReference Include="OpenActive.NET" Version="15.2.21" />
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
<PackageReference Include="OpenActive.NET" Version="15.2.17" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions OpenActive.Server.NET/OpenActive.Server.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OpenActive.DatasetSite.NET" Version="6.0.2" />
<PackageReference Include="OpenActive.NET" Version="15.2.17" />
<PackageReference Include="OpenActive.DatasetSite.NET" Version="6.0.4" />
<PackageReference Include="OpenActive.NET" Version="15.2.21" />
<PackageReference Include="UriTemplate.Core" Version="1.0.2" />
</ItemGroup>

Expand Down
14 changes: 14 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}

0 comments on commit 119c30e

Please sign in to comment.