Skip to content

Commit

Permalink
Merging development branch so main branch can track workflows (#103)
Browse files Browse the repository at this point in the history
* Added test project

* Added ADR docs

* Added basic unit tests

* added ADR

* updated folder structure

* restructure

* Added architecture diagram

* More unit tests

* Added DI test

* Added contentful model for richtext

* Updated content service (#82)

* Updated content service

* uncommented tests

* undid spacing change

---------

Co-authored-by: Simon FIRTH <[email protected]>
Co-authored-by: Tom Whittington <[email protected]>

* Created contentful stub

* Updated to query builder

* Add renderer for rich text content (#75)

* add renderer for rich text content

* Add interface for content renderer

* remove unused using statements

* refactor: use partial views to handle rich text rendering

* Add new project for e2e cypress tests

* remove magic strings

* wip: Add mock content for e2e tests

* Update page heading and add support for subheadings

* update mockContent for e2e tests

* add rich text support for horizontal rule

* add support for embedded image assets

* Add support for embedded video

* add support for embedded vimeo player

* Changed views to use explicit models

* Added dev settings to gitignore

* Removed main

---------

Co-authored-by: Tom Whittington <[email protected]>

* updated e2e and app settings

* Updated tests

* Fixed/ added some tests for coverage

* Added tests for HttpClients

* Added service tests

* Refactored tests

---------

Co-authored-by: Tom Whittington <[email protected]>

* Feature/ rework/linking (#86)

* Lowered HR to Hr

* Added support for linking to content

---------

Co-authored-by: Tom Whittington <[email protected]>

* wip: render linked entry and asset from within rich text

* wip: render download component

* display corresponding icon for download filetype

* update e2e tests

* Feature/ rework/embedded entries (#87)

* Added basic support for embeddedEntries

* Added includes to configuration

* Updated tests for new model

* Simplified include logic

* Fixed client test

---------

Co-authored-by: Tom Whittington <[email protected]>

* update entry partial

* revert ContentService changes

* use target variable in entry partial

* tweak entry partial

* update file icons

* Added terraform scripts

* add accordion component

* Added workflows and actions

* adding missing WAF and updated contentful environment

* update integration tests

* wip: add accessibility tweaks, accessibilty tests and page layout updates

* Added support for cards and grid containers. Updated dfeFrontend to 2.0.1 (#91)

* Updated DfeFrontend

* Added basic card support

* Card cleanup

* Added grid container

* Updated svgs

---------

Co-authored-by: Tom Whittington <[email protected]>

* use dfe container width and update header styling

* updated workflow

* TF changes to get inital build going

* fixed tflint

* removed unused vars from pr-check

* added dev environment

* lock updated

* reformatted locals.tf

* terraform-docs: automated action

* include hero in header

* fix e2e tests

* Updated JS + CSS files

* add support for multiple accordion sections

* resolve assets for e2e testing

* Capitalise development branch name (#93)

* Capitalise development branch name

* force workflow to appear in actions

* Matrix deploy push

* made context root

* moved docker file location

* adjusted docker file location

* lowercase dockerfile name

* moved docker file

* updated matrix deploy

* updated deploy script

* updated image name

* revision create change

* Added env variable

* updated to main

* updated cli version

* removed env

* updated workflow to dispatch

* Feature/app insights (#97)

* Capitalise development branch name

* force workflow to appear in actions

* Matrix deploy push

* made context root

* moved docker file location

* adjusted docker file location

* lowercase dockerfile name

* moved docker file

* updated matrix deploy

* updated deploy script

* updated image name

* revision create change

* Added env variable

* updated to main

* updated cli version

* removed env

* updated workflow to dispatch

* Added application insights + secret management

* Feature/vault (#98)

* Capitalise development branch name

* force workflow to appear in actions

* Matrix deploy push

* made context root

* moved docker file location

* adjusted docker file location

* lowercase dockerfile name

* moved docker file

* updated matrix deploy

* updated deploy script

* updated image name

* revision create change

* Added env variable

* updated to main

* updated cli version

* removed env

* updated workflow to dispatch

* Added application insights + secret management

* modified matrix deploy to run on completed PR

* Added Keyvault secret API to application startup

* fixed YAML

* modifed matrix deloy (#100)

* Updated workflow so it can be manually fired (#102)

* modifed matrix deloy

* changed to workflow dispatch

* removed env

* changed keyvault name

* changed keyvault name

* re-added env

---------

Co-authored-by: Tom Whittington <[email protected]>
Co-authored-by: Simon FIRTH <[email protected]>
Co-authored-by: ThomasWhittington <[email protected]>
Co-authored-by: jack-coggin <[email protected]>
Co-authored-by: jack.coggin <[email protected]>
Co-authored-by: Iain STANGER <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
9 people authored Jun 26, 2024
1 parent 6d38436 commit c275836
Show file tree
Hide file tree
Showing 173 changed files with 17,254 additions and 28,843 deletions.
42 changes: 42 additions & 0 deletions .github/actions/azure-ip-whitelist/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Azure IP Whitelist
description: Add or remove an IP Address to the Azure KV + SQL whitelist

inputs:
ip_address:
required: true
type: string
verb:
required: true
type: choice
options:
- "add"
- "remove"
az_resource_group:
required: true
type: string
az_keyvault_name:
required: true
type: string
az_ip_name:
type: string
default: "github_action"
az_sql_database_server_name:
required: true
type: string

runs:
using: composite
steps:
- name: Add to whitelist
if: ${{ inputs.verb == 'add' }}
shell: bash
run: |
az keyvault network-rule add --resource-group ${{ inputs.az_resource_group }} --name ${{ inputs.az_keyvault_name }} --ip-address ${{ inputs.ip_address }} &> /dev/null
az sql server firewall-rule create --resource-group ${{ inputs.az_resource_group }} --server ${{ inputs.az_sql_database_server_name }} --name ${{ inputs.az_ip_name }} --start-ip-address ${{ inputs.ip_address }} --end-ip-address ${{ inputs.ip_address }} &> /dev/null
- name: Remove from whitelist
if: ${{ inputs.verb == 'remove' }}
shell: bash
run: |
az keyvault network-rule remove --resource-group ${{ inputs.az_resource_group }} --name ${{ inputs.az_keyvault_name }} --ip-address ${{ inputs.ip_address }} &> /dev/null
az sql server firewall-rule delete --resource-group ${{ inputs.az_resource_group }} --server ${{ inputs.az_sql_database_server_name }} --name ${{ inputs.az_ip_name }} &> /dev/null
4 changes: 1 addition & 3 deletions .github/actions/azure-login/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ runs:
- name: Azure login with ACA credentials
uses: azure/login@v1
with:
creds: '{"clientId":"${{ inputs.az_client_id }}","clientSecret":"${{ inputs.az_client_secret }}","subscriptionId":"${{ inputs.az_subscription_id }}","tenantId":"${{ inputs.az_tenant_id }}"}'

#test
creds: '{"clientId":"${{ inputs.az_client_id }}","clientSecret":"${{ inputs.az_client_secret }}","subscriptionId":"${{ inputs.az_subscription_id }}","tenantId":"${{ inputs.az_tenant_id }}"}'
10 changes: 10 additions & 0 deletions .github/actions/build-docker-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Build Docker Image
description: Builds the docker image

runs:
using: composite

steps:
- name: Build Docker image
shell: bash
run: docker build ./src/ --file ./.dockerfile --tag dfe-digital_sts-content-and-support:$(date +%s)
25 changes: 25 additions & 0 deletions .github/actions/build-dotnet-app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build DotNet App
description: Sets up .Net for specified version and builds application

inputs:
dotnet_version:
required: true
type: string
solution_filename:
required: true
type: string

runs:
using: composite

steps:
- name: Setup .NET Core SDK ${{ inputs.dotnet_version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet_version }}
- name: Install dependencies
shell: bash
run: dotnet restore ${{ inputs.solution_filename }}
- name: Build
shell: bash
run: dotnet build ${{ inputs.solution_filename }} --configuration Release --no-restore --output ./build
24 changes: 24 additions & 0 deletions .github/actions/list-directory/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: List Directory
description: Get a list of folders from a given input source directory as a JSON array.

inputs:
source:
required: true
type: string
outputs:
directories:
value: ${{ steps.list-dir.outputs.directories }}

runs:
using: composite

steps:
- name: Get List of Directories
id: list-dir
shell: bash
run: |
cd ${{ inputs.source }}
array=(*/)
directories="$(jq -c -n '$ARGS.positional' --args "${array[@]}")"
echo $directories
echo "directories=$directories" >> $GITHUB_OUTPUT
92 changes: 92 additions & 0 deletions .github/actions/post-terraform-results/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Post Terraform Results
description: Updates the PR with the Terraform results

inputs:
github_token:
required: true
type: string
plan_stdout:
required: true
type: string
plan_outcome:
required: true
type: string
fmt_outcome:
required: true
type: string
init_outcome:
required: true
type: string
validate_outcome:
required: true
type: string
validate_stdout:
required: true
type: string
github_actor:
required: true
type: string
github_event_name:
required: true
type: string
tf_working_directory:
required: true
type: string
github_workflow:
required: true
type: string

runs:
using: composite

steps:
- name: Update PR with Terraform results
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ inputs.plan_stdout }}"
with:
github-token: ${{ inputs.github_token }}
script: |
// 1. Retrieve existing bot comments for the PR
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
})
const botComment = comments.find(comment => {
return comment.user.type === 'Bot' && comment.body.includes('Terraform Format and Style')
})
// 2. Prepare format of the comment
const output = `#### Terraform Format and Style 🖌\`${{ inputs.fmt_outcome }}\`
#### Terraform Initialization ⚙️\`${{ inputs.init_outcome }}\`
#### Terraform Validation 🤖\`${{ inputs.validate_outcome }}\`
<details><summary>Validation Output</summary>

\`\`\`\n
${{ inputs.validate_stdout }}
\`\`\`

</details>

#### Terraform Plan 📖\`${{ inputs.plan_outcome }}\`

*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.TF_WORKING_DIRECTORY }}\`, Workflow: \`${{ github.workflow }}\`*`;

// 3. If we have a comment, update it, otherwise create a new one
if (botComment) {
github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: output
})
} else {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
}
23 changes: 23 additions & 0 deletions .github/actions/run-unit-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Unit Tests
description: Runs the unit tests and publishes them to the workflow runs

inputs:
solution_filename:
required: true
type: string

runs:
using: composite

steps:
- name: Test
shell: bash
run: dotnet test ${{ inputs.solution_filename }} --no-restore --verbosity normal --collect:"XPlat Code Coverage" --logger:"trx;LogFileName=test-results.trx" || true
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: DotNET Tests
path: "**/test-results.trx"
reporter: dotnet-trx
fail-on-error: true
16 changes: 16 additions & 0 deletions .github/semver-release/.releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"successComment": false
}
]
],
"branches": [
{ "name": "main" },
{ "name": "development", "prerelease": true }
]
}
Loading

0 comments on commit c275836

Please sign in to comment.