Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tahb committed Apr 1, 2021
2 parents c76e1fc + 061f8db commit c895272
Show file tree
Hide file tree
Showing 312 changed files with 9,644 additions and 2,267 deletions.
17 changes: 14 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,30 @@
#
# Reference: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use

APPLICATION_URL=http://localhost:3000

# Rollbar for application monitoring
ROLLBAR_ACCESS_TOKEN=ROLLBAR_ACCESS_TOKEN
ROLLBAR_ENV=development

DATABASE_URL=postgres://postgres@localhost:5432/buy-for-your-school-development
REDIS_CACHE_URL=redis://localhost:6379/1
REDIS_SIDEKIQ_URL=redis://localhost:6379/2
REDIS_URL=redis://localhost:6379

# Contentful
CONTENTFUL_URL=cdn.contentful.com
CONTENTFUL_SPACE=
CONTENTFUL_ENVIRONMENT=master
CONTENTFUL_ACCESS_TOKEN=
CONTENTFUL_PLANNING_START_ENTRY_ID=
CONTENTFUL_PREVIEW_APP=false
CONTENTFUL_ENTRY_CACHING=false
CONTENTFUL_DEFAULT_CATEGORY_ENTRY_ID=contentful-category-entry

# API
CONTENTFUL_WEBHOOK_API_KEY=

# DfE Sign-in
DFE_SIGN_IN_ISSUER=https://test-oidc.signin.education.gov.uk:443
DFE_SIGN_IN_IDENTIFIER=buyforyourschool
DFE_SIGN_IN_SECRET=
DFE_SIGN_IN_REDIRECT_URL=http://localhost:3000/auth/dfe/callback
DFE_SIGN_IN_ENABLED=true
10 changes: 7 additions & 3 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
#
# Reference: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use

APPLICATION_URL=http://localhost:3000

DATABASE_URL=postgres://postgres@localhost:5432/buy-for-your-school-test
REDIS_CACHE_URL=redis://localhost:6379/11
REDIS_SIDEKIQ_URL=redis://localhost:6379/12
REDIS_URL=redis://localhost:6379

# Contentful
CONTENTFUL_URL=cdn.contentful.com
CONTENTFUL_SPACE=test
CONTENTFUL_ENVIRONMENT=master
CONTENTFUL_ACCESS_TOKEN=123
CONTENTFUL_PLANNING_START_ENTRY_ID=contentful-starting-step
CONTENTFUL_PREVIEW_APP=false
CONTENTFUL_ENTRY_CACHING=false
CONTENTFUL_DEFAULT_CATEGORY_ENTRY_ID=contentful-category-entry

# API
CONTENTFUL_WEBHOOK_API_KEY=
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
### After

## Next steps

<!-- - [] Document this change in [Confluence](https://dfedigital.atlassian.net/wiki/spaces/GHBFS) -->
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Build
run: docker-compose -f docker-compose.ci.yml build
- name: Test
run: docker-compose -f docker-compose.ci.yml run --rm test bundle exec rake
run: docker-compose -f docker-compose.ci.yml run --rm test script/test
58 changes: 58 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: deploy

on:
push:
branches:
- main
- develop

env:
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
GHCR_PASSWORD: ${{ secrets.GHCR_PASSWORD }}
GHCR_REPO: "ghcr.io/dfe-digital/buy-for-your-school"
CF_USER: ${{ secrets.CF_USER }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_SECRETS_JSON: ${{ toJson(secrets) }}

jobs:
build:
runs-on: ubuntu-latest
outputs:
tf_var_docker_image: ${{ steps.tf_var_docker_image.outputs.value }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set Docker tag environment variable
run: echo "DOCKER_TAG=${GITHUB_RUN_ID}-${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set Docker Image environment variable
run: echo "DOCKER_IMAGE=$GHCR_REPO:$DOCKER_TAG" >> $GITHUB_ENV
- name: Set TFVAR Docker Image environment variable
run: echo "TF_VAR_docker_image=$DOCKER_IMAGE" >> $GITHUB_ENV
- name: Set TFVAR Docker Image output
id: tf_var_docker_image
run: echo "::set-output name=value::$TF_VAR_docker_image"
- name: Build
run: script/docker-push-ghcr

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set TFVAR Docker Image environment variable
run: echo "TF_VAR_docker_image=${{needs.build.outputs.tf_var_docker_image}}" >> $GITHUB_ENV
- name: Deploy terraform to staging
env:
TF_VAR_environment: "staging"
run: |
script/deploy-terraform
if: github.ref == 'refs/heads/develop'
- name: Deploy terraform to prod
env:
TF_VAR_environment: "prod"
run: |
script/deploy-terraform
if: github.ref == 'refs/heads/main'
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ rerun.txt
pickle-email-*.html
.zeus.sock
/node_modules
/spec/examples.txt

# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
Expand Down Expand Up @@ -92,3 +93,22 @@ config/master.key
.env.*
!.env.example
!.env.test

# Terraform files
**/.terraform/*
*.tfstate
*.tfstate.*
crash.log
*.tfvars
.terraformrc
terraform.rc

# Data dumps (might lead to accidental data breach)
*.dump
*.sql
*.csv
*.xls

# App env yaml files
*_app_env.yml
*_app_env.yaml
61 changes: 56 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,56 @@ The format is based on [Keep a Changelog 1.0.0].

## [Unreleased]

## [release-006] - 2021-04-01

- specification templates are now sourced from the Contentful Category entry
- refactor how we find all journey answers into isolated service
- users are now told how they can resume a journey, and an address is provided for this
- robots.txt now excludes all journey and step pages
- steps/questions/tasks in the task lists are now grouped by Contentful Section entries
- start page now has revised copy with details on eligibility and what to expect
- The journey map is now clearer about what happens when you click a link
- The journey map now includes links to preview a step
- The journey map now displays markup to include a step's answer in the specification template
- users can answer questions which expect a number
- checkbox questions no longer alter the capitalisation of options
- fix ordering of section and step items
- users can answer questions which expect a currency
- questions can be hidden from view
- specification warning if there are incomplete tasks
- hidden questions can be shown through a new show_additional_question field for each question
- hidden questions can be rehidden again after changing the original answer
- hidden questions that were at one point answered, will be reshown with a change to an earlier question
- fix Redis connection errors on Heroku
- users can be asked extended checkbox questions which ask for further information
- markdown in help text fields is now parsed into HTML
- show and hide more than one additional question at a time
- users can be presenting with forking/branching question chains based on any one answer
- create an extended further information text box option for radio answers
- create extended further information text box option for checkbox answers
- radio questions can be configured with an "or" separator
- specification can show further information for radio answers
- specification can show further information for checkbox answers
- checkbox answers can be completed without choosing a given answer
- fix planning page link back to the service
- checkbox answers are not automatically joined by commas for the specification
- answer data is all available through the single `answer_x` convention, this has replaced `extended_answer_x` which has now been removed
- checkbox answers that are skipped can be identified in the specification
- fix branching so multiple rules can show the same question
- the specification lives on it's own page, separate to the task list
- fix checkbox questions where further information couldn't be saved for an option that included a special character
- further information for options that include special characters is now available to the specification
- incomplete specification documents include a warning within the document as well as the file name
- users return to the same place in the task list after answering a question
- fix extended radio questions so that further_information can be remembered when it can be provided through multiple fields
- flash messages can be shown in notification banners
- fix checkbox answer to save choices after previously skipping
- users can sign in using DfE Sign-in
- users can sign out using DfE Sign-in
- add new dashboard page with the ability to create new specifications
- users can only see their past journeys from the dashboard
- new API endpoint to allow Contentful to invalidate cached entries, allowing caching to stay on which prevents the app from being very slow/crashing on journey start

## [release-005] - 2021-1-19

- users can see an initial slice of their specification as HTML at the end of their journey
Expand Down Expand Up @@ -50,20 +100,21 @@ The format is based on [Keep a Changelog 1.0.0].
## [release-001] - 2020-11-12

- address rails-template TODO
- any user can see a start page for the planning journey
- any user can see a start page for the specifying journey
- use GOV.UK Frontend framework
- users can see a basic form to start the planning journey sourced by a
- users can see a basic form to start the specifying journey sourced by a
Contentful fixture
- planning form is styled as a GOV.UK form
- specifying form is styled as a GOV.UK form
- validate that an answer is provided to a question
- the first planning question comes directly from Contentful
- the first specifying question comes directly from Contentful
- handle the exceptional case when a Contentful entry is missing
- multiple radio questions can be answered in sequence
- users can be asked to answer a short text question
- Contentful can redirect users to preview endpoints
- users can be asked to answer a long text question

[unreleased]: https://github.com/DFE-Digital/buy-for-your-school/compare/release-005...HEAD
[unreleased]: https://github.com/DFE-Digital/buy-for-your-school/compare/release-006...HEAD
[release-006]: https://github.com/DFE-Digital/buy-for-your-school/compare/release-005...release-006
[release-005]: https://github.com/DFE-Digital/buy-for-your-school/compare/release-004...release-005
[release-004]: https://github.com/DFE-Digital/buy-for-your-school/compare/release-003...release-004
[release-003]: https://github.com/DFE-Digital/buy-for-your-school/compare/release-002...release-003
Expand Down
17 changes: 16 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,22 @@ RUN bundle config set no-cache "true"
RUN bundle config set with $BUNDLE_GEM_GROUPS
RUN bundle install --no-binstubs --retry=3 --jobs=4

COPY . .
# Copy app code (sorted by vague frequency of change for caching)
RUN mkdir -p ${INSTALL_PATH}/log
RUN mkdir -p ${INSTALL_PATH}/tmp

COPY config.ru ${INSTALL_PATH}/config.ru
COPY Rakefile ${INSTALL_PATH}/Rakefile

COPY public ${INSTALL_PATH}/public
COPY vendor ${INSTALL_PATH}/vendor
COPY bin ${INSTALL_PATH}/bin
COPY lib ${INSTALL_PATH}/lib
COPY config ${INSTALL_PATH}/config
COPY db ${INSTALL_PATH}/db
COPY script ${INSTALL_PATH}/script
COPY app ${INSTALL_PATH}/app
# End

# RELEASE STAGE #
FROM ruby:2.6.6 AS release
Expand Down
14 changes: 9 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ gem "bootsnap", ">= 1.1.0", require: false
gem "climate_control"
gem "coffee-rails", "~> 5.0"
gem "contentful", "~> 2.15"
gem "govuk_design_system_formbuilder", "~> 2.1"
gem "govuk_design_system_formbuilder", "~> 2.2"
gem "high_voltage"
gem "htmltoword"
gem "jbuilder", "~> 2.5"
gem "jbuilder", "~> 2.11"
gem "jquery-rails"
gem "liquid"
gem "pg"
gem "mini_racer"
gem "puma", "~> 5.1"
gem "omniauth"
gem "omniauth_openid_connect"
gem "omniauth-rails_csrf_protection"
gem "puma", "~> 5.2"
gem "redcarpet", "~> 3.5"
gem "redis", "~> 4.2"
gem "redis-namespace"
gem "rollbar"
gem "rails", "~> 6.1.1"
gem "rails", "~> 6.1.3"
gem "sass-rails", "~> 6.0"
gem "sidekiq", "~> 6.1"
gem "sidekiq", "~> 6.2"
gem "sidekiq-cron", "~> 1.2"
gem "turbolinks", "~> 5"
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
Expand Down
Loading

0 comments on commit c895272

Please sign in to comment.