Skip to content

Commit

Permalink
Merge pull request #407 from DFE-Digital/perform-release
Browse files Browse the repository at this point in the history
Perform release
  • Loading branch information
albal authored Feb 5, 2024
2 parents e5fda1c + 7856438 commit 0acbdd5
Show file tree
Hide file tree
Showing 36 changed files with 1,836 additions and 742 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/create-schema-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Production Create Schema Release

on: workflow_dispatch

jobs:
create-schema-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
working-directory: ./Contentful-Schema/
run: |
npm ci
- name: Build scripts
working-directory: ./Contentful-Schema/
run: |
npx tsc
- name: Run script
env:
CONTENTFUL_MANAGEMENT_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }}
CPD_SPACE_ID: ${{ secrets.TF_VAR_CPD_SPACE_ID }}
working-directory: ./Contentful-Schema
run: |
node ./dist/scripts/schema-release-process/create-new-env-version.js -s pre-prod -t master
28 changes: 28 additions & 0 deletions .github/workflows/rollback-master-alias-to-previous-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Production rollback master alias to previous release

on: workflow_dispatch

jobs:
create-schema-release:
runs-on: ubuntu-latest
environment: Prod
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
working-directory: ./Contentful-Schema/
run: |
npm ci
- name: Build scripts
working-directory: ./Contentful-Schema/
run: |
npx tsc
- name: Run script
env:
CONTENTFUL_MANAGEMENT_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }}
CPD_SPACE_ID: ${{ secrets.TF_VAR_CPD_SPACE_ID }}
working-directory: ./Contentful-Schema
run: |
node ./dist/scripts/schema-release-process/switch-alias-for-release.js -a master -r
28 changes: 28 additions & 0 deletions .github/workflows/switch-master-alias-to-new-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Production switch master alias to new release

on: workflow_dispatch

jobs:
create-schema-release:
runs-on: ubuntu-latest
environment: Prod
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
working-directory: ./Contentful-Schema/
run: |
npm ci
- name: Build scripts
working-directory: ./Contentful-Schema/
run: |
npx tsc
- name: Run script
env:
CONTENTFUL_MANAGEMENT_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }}
CPD_SPACE_ID: ${{ secrets.TF_VAR_CPD_SPACE_ID }}
working-directory: ./Contentful-Schema
run: |
node ./dist/scripts/schema-release-process/switch-alias-for-release.js -a master
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class EntityResolverTests
[TestCase("contentSeparator", typeof(ContentSeparator))]
[TestCase("detailedPathway", typeof(DetailedPathway))]
[TestCase("detailedRole", typeof(DetailedRole))]
[TestCase("feedback", typeof(Feedback))]
[TestCase("heroBanner", typeof(HeroBanner))]
[TestCase("imageCard", typeof(ImageCard))]
[TestCase("linkCard", typeof(LinkCard))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class PartialsFactoryTests
new object[] { new ContentSeparator(), "_ContentSeparator" },
new object[] { new DetailedPathway(), "_DetailedPathway" },
new object[] { new DetailedRole(), "_DetailedRole" },
new object[] { new Feedback(), "_Feedback" },
new object[] { new HeroBanner(), string.Empty },
new object[] { new LinkCard(), "_LinkCard" },
new object[] { new ImageCard(), "_ImageCard" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using NSubstitute;
using NUnit.Framework;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -23,7 +21,6 @@ public class ContentControllerTests
private HttpContext _httpContext;
private HttpRequest _httpRequest;
private ICpdContentfulClient _contentfulClient;
private CancellationTokenSource _cancellationTokenSource;

private void SetContent(Content content)
{
Expand All @@ -36,8 +33,6 @@ private void SetContent(Content content)
_contentfulClient
.GetEntries(Arg.Any<QueryBuilder<Content>>(), Arg.Any<CancellationToken>())
.Returns(contentCollection);

_cancellationTokenSource = new CancellationTokenSource();
}

[SetUp]
Expand Down Expand Up @@ -68,7 +63,7 @@ public async Task Index_Returns_404_When_No_Content_Found()
SetContent(null);

// act
var actual = await _contentController.Index(_cancellationTokenSource.Token, "home");
var actual = await _contentController.Index("home");

// assert
actual.Should().BeOfType<NotFoundResult>();
Expand All @@ -81,7 +76,7 @@ public async Task Index_Returns_View()
SetContent(new Content());

// act
var actual = await _contentController.Index(_cancellationTokenSource.Token, "home");
var actual = await _contentController.Index("home");

// assert
actual.Should().BeOfType<ViewResult>();
Expand All @@ -100,7 +95,7 @@ public async Task Index_Sets_The_ViewState_ContextModel()
SetContent(rootContent);

// act
await _contentController.Index(_cancellationTokenSource.Token, "home");
await _contentController.Index("home");
var actual = _contentController.ViewData["ContextModel"] as ContextModel;

// assert
Expand All @@ -118,7 +113,7 @@ public async Task Index_Sets_The_ContextModel_Preferences_Set_Value_Correctly(bo
SetContent(new Content());

// act
await _contentController.Index(_cancellationTokenSource.Token, "home", preferenceSet);
await _contentController.Index("home", preferenceSet);
var actual = _contentController.ViewData["ContextModel"] as ContextModel;

// assert
Expand All @@ -144,7 +139,7 @@ public async Task Index_Sets_The_ContextModel_UseContainers_From_SideMenu_Value_
SetContent(rootContent);

// act
await _contentController.Index(_cancellationTokenSource.Token, "home");
await _contentController.Index("home");
var actual = _contentController.ViewData["ContextModel"] as ContextModel;

// assert
Expand All @@ -161,7 +156,7 @@ public async Task Index_Trims_Trailing_Slashes()
await _contentfulClient.GetEntries(Arg.Do<QueryBuilder<Content>>(value => query = value.Build()), Arg.Any<CancellationToken>());

// act
var actual = await _contentController.Index(_cancellationTokenSource.Token, "home/");
var actual = await _contentController.Index("home/", false);

// assert
query.Should().Contain("fields.id=home&");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void SetUp()
#region SetPreferences

[Test]
[Ignore("")]
[TestCase(CookieHelper.ANALYTICSCOOKIEACCEPTED)]
[TestCase(CookieHelper.ANALYTICSCOOKIEREJECTED)]
public async Task SetPreferences_Sets_Cookie(string consentValue)
Expand All @@ -55,6 +56,7 @@ public async Task SetPreferences_Sets_Cookie(string consentValue)
}

[Test]
[Ignore("")]
[TestCase("")]
[TestCase("invalid")]
public async Task SetPreferences_Clear_Cookie(string consentValue)
Expand Down
Loading

0 comments on commit 0acbdd5

Please sign in to comment.