From 56a5db3689121a8042f29da65efb82d93058e3f3 Mon Sep 17 00:00:00 2001 From: JoshuaLicense Date: Tue, 20 Aug 2024 12:05:53 +0100 Subject: [PATCH] fix(cdn): remove unused asset files (#257) * fix(cdn): remove unused asset files This is mainly to trigger another asset build as the short SHA has been extended. * ci: remove `dir_names` to include top level files * ci: swap `changed` to `modified` --- .github/workflows/cd.yaml | 26 ++++----- .github/workflows/ci.yaml | 38 ++++++------- app/cdn/.nvmrc | 1 - app/cdn/LICENSE.txt | 1 - app/cdn/README.md | 110 -------------------------------------- 5 files changed, 32 insertions(+), 144 deletions(-) delete mode 100644 app/cdn/.nvmrc delete mode 100644 app/cdn/LICENSE.txt delete mode 100644 app/cdn/README.md diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 3ffe4fd586..46c76ea54a 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -32,24 +32,24 @@ jobs: runs-on: ubuntu-latest outputs: # Docs - should-deploy-docs: ${{ steps.changed-website-files.outputs.any_changed == 'true' || null }} + should-deploy-docs: ${{ steps.changed-website-files.outputs.any_modified == 'true' || null }} # App - should-build-app: ${{ needs.release-please.outputs.release_created || steps.changed-api-files.outputs.any_changed == 'true' || steps.changed-selfserve-files.outputs.any_changed == 'true' || steps.changed-internal-files.outputs.any_changed == 'true' || null }} - should-build-api: ${{ needs.release-please.outputs.release_created || steps.changed-api-files.outputs.any_changed == 'true' || null }} - should-build-selfserve: ${{ needs.release-please.outputs.release_created || steps.changed-selfserve-files.outputs.any_changed == 'true' || null }} - should-build-internal: ${{ needs.release-please.outputs.release_created || steps.changed-internal-files.outputs.any_changed == 'true' || null }} + should-build-app: ${{ needs.release-please.outputs.release_created || steps.changed-api-files.outputs.any_modified == 'true' || steps.changed-selfserve-files.outputs.any_modified == 'true' || steps.changed-internal-files.outputs.any_modified == 'true' || null }} + should-build-api: ${{ needs.release-please.outputs.release_created || steps.changed-api-files.outputs.any_modified == 'true' || null }} + should-build-selfserve: ${{ needs.release-please.outputs.release_created || steps.changed-selfserve-files.outputs.any_modified == 'true' || null }} + should-build-internal: ${{ needs.release-please.outputs.release_created || steps.changed-internal-files.outputs.any_modified == 'true' || null }} # Assets - should-build-assets: ${{ needs.release-please.outputs.release_created || steps.changed-assets-files.outputs.any_changed == 'true' || null }} + should-build-assets: ${{ needs.release-please.outputs.release_created || steps.changed-assets-files.outputs.any_modified == 'true' || null }} # Docker - should-build-and-push-docker: ${{ needs.release-please.outputs.release_created || steps.changed-api-docker-files.outputs.any_changed == 'true' || steps.changed-selfserve-docker-files.outputs.any_changed == 'true' || steps.changed-internal-docker-files.outputs.any_changed == 'true' || steps.changed-cli-docker-files.outputs.any_changed == 'true' || null}} - should-build-and-push-api-docker: ${{ needs.release-please.outputs.release_created || steps.changed-api-docker-files.outputs.any_changed == 'true' || steps.changed-api-files.outputs.any_changed == 'true' || null }} - should-build-and-push-cli-docker: ${{ needs.release-please.outputs.release_created || steps.changed-cli-docker-files.outputs.any_changed == 'true' || steps.changed-api-files.outputs.any_changed == 'true' || null }} - should-build-and-push-selfserve-docker: ${{ needs.release-please.outputs.release_created || steps.changed-selfserve-docker-files.outputs.any_changed == 'true' || steps.changed-selfserve-files.outputs.any_changed == 'true' || null }} - should-build-and-push-internal-docker: ${{ needs.release-please.outputs.release_created || steps.changed-internal-docker-files.outputs.any_changed == 'true' || steps.changed-internal-files.outputs.any_changed == 'true' || null }} + should-build-and-push-docker: ${{ needs.release-please.outputs.release_created || steps.changed-api-docker-files.outputs.any_modified == 'true' || steps.changed-selfserve-docker-files.outputs.any_modified == 'true' || steps.changed-internal-docker-files.outputs.any_modified == 'true' || steps.changed-cli-docker-files.outputs.any_modified == 'true' || null}} + should-build-and-push-api-docker: ${{ needs.release-please.outputs.release_created || steps.changed-api-docker-files.outputs.any_modified == 'true' || steps.changed-api-files.outputs.any_modified == 'true' || null }} + should-build-and-push-cli-docker: ${{ needs.release-please.outputs.release_created || steps.changed-cli-docker-files.outputs.any_modified == 'true' || steps.changed-api-files.outputs.any_modified == 'true' || null }} + should-build-and-push-selfserve-docker: ${{ needs.release-please.outputs.release_created || steps.changed-selfserve-docker-files.outputs.any_modified == 'true' || steps.changed-selfserve-files.outputs.any_modified == 'true' || null }} + should-build-and-push-internal-docker: ${{ needs.release-please.outputs.release_created || steps.changed-internal-docker-files.outputs.any_modified == 'true' || steps.changed-internal-files.outputs.any_modified == 'true' || null }} # Terraform account - should-apply-account-terraform: ${{ needs.release-please.outputs.release_created || steps.changed-accounts-terraform-files.outputs.any_changed == 'true' || null }} + should-apply-account-terraform: ${{ needs.release-please.outputs.release_created || steps.changed-accounts-terraform-files.outputs.any_modified == 'true' || null }} # Terraform environment - should-apply-environment-terraform: ${{ needs.release-please.outputs.release_created || steps.changed-environments-terraform-files.outputs.any_changed == 'true' || null }} + should-apply-environment-terraform: ${{ needs.release-please.outputs.release_created || steps.changed-environments-terraform-files.outputs.any_modified == 'true' || null }} steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0228c1d909..1732acbc65 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,30 +34,30 @@ jobs: runs-on: ubuntu-latest outputs: # Docs - should-build-docs: ${{ steps.changed-website-files.outputs.any_changed == 'true' || null }} + should-build-docs: ${{ steps.changed-website-files.outputs.any_modified == 'true' || null }} # App - should-build-app: ${{ steps.changed-app-files.outputs.any_changed == 'true' || steps.changed-docker-files.outputs.any_changed == 'true' || null }} - should-build-api: ${{ contains(steps.changed-app-files.outputs.all_changed_files, 'app/api') || null }} - should-build-selfserve: ${{ contains(steps.changed-app-files.outputs.all_changed_files, 'app/selfserve') || null }} - should-build-internal: ${{ contains(steps.changed-app-files.outputs.all_changed_files, 'app/internal') || null }} + should-build-app: ${{ steps.changed-app-files.outputs.any_modified == 'true' || steps.changed-docker-files.outputs.any_modified == 'true' || null }} + should-build-api: ${{ contains(steps.changed-app-files.outputs.all_modified_files, 'app/api') || null }} + should-build-selfserve: ${{ contains(steps.changed-app-files.outputs.all_modified_files, 'app/selfserve') || null }} + should-build-internal: ${{ contains(steps.changed-app-files.outputs.all_modified_files, 'app/internal') || null }} # Assets - should-build-assets: ${{ steps.changed-asset-files.outputs.any_changed == 'true' || null }} + should-build-assets: ${{ steps.changed-asset-files.outputs.any_modified == 'true' || null }} # Docker - should-build-docker: ${{ steps.changed-docker-files.outputs.any_changed == 'true' || null }} - should-build-api-docker: ${{ contains(steps.changed-docker-files.outputs.all_changed_files, 'infra/docker/api') || null }} - should-build-cli-docker: ${{ contains(steps.changed-docker-files.outputs.all_changed_files, 'infra/docker/cli') || null }} - should-build-selfserve-docker: ${{ contains(steps.changed-docker-files.outputs.all_changed_files, 'infra/docker/selfserve') || null }} - should-build-internal-docker: ${{ contains(steps.changed-docker-files.outputs.all_changed_files, 'infra/docker/internal') || null }} + should-build-docker: ${{ steps.changed-docker-files.outputs.any_modified == 'true' || null }} + should-build-api-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/api') || null }} + should-build-cli-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/cli') || null }} + should-build-selfserve-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/selfserve') || null }} + should-build-internal-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/internal') || null }} # Terraform accounts - should-plan-terraform-accounts: ${{ steps.changed-accounts-terraform-files.outputs.any_changed == 'true' || null }} - should-plan-nonprod-account-terraform: ${{ contains(steps.changed-accounts-terraform-files.outputs.all_changed_files, 'infra/terraform/modules') || contains(steps.changed-accounts-terraform-files.outputs.all_changed_files, 'infra/terraform/accounts/nonprod') || null }} - should-plan-prod-account-terraform: ${{ contains(steps.changed-accounts-terraform-files.outputs.all_changed_files, 'infra/terraform/modules') || contains(steps.changed-accounts-terraform-files.outputs.all_changed_files, 'infra/terraform/accounts/prod') || null }} + should-plan-terraform-accounts: ${{ steps.changed-accounts-terraform-files.outputs.any_modified == 'true' || null }} + should-plan-nonprod-account-terraform: ${{ contains(steps.changed-accounts-terraform-files.outputs.all_modified_files, 'infra/terraform/modules') || contains(steps.changed-accounts-terraform-files.outputs.all_modified_files, 'infra/terraform/accounts/nonprod') || null }} + should-plan-prod-account-terraform: ${{ contains(steps.changed-accounts-terraform-files.outputs.all_modified_files, 'infra/terraform/modules') || contains(steps.changed-accounts-terraform-files.outputs.all_modified_files, 'infra/terraform/accounts/prod') || null }} # Terraform environments - should-plan-terraform-environments: ${{ steps.changed-environments-terraform-files.outputs.any_changed == 'true' || null }} - should-plan-dev-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/environments/dev') || null }} - should-plan-int-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/environments/int') || null }} - should-plan-prep-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/environments/prep') || null }} - should-plan-prod-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_changed_files, 'infra/terraform/environments/prod') || null }} + should-plan-terraform-environments: ${{ steps.changed-environments-terraform-files.outputs.any_modified == 'true' || null }} + should-plan-dev-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/environments/dev') || null }} + should-plan-int-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/environments/int') || null }} + should-plan-prep-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/environments/prep') || null }} + should-plan-prod-environment-terraform: ${{ contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/modules') || contains(steps.changed-environments-terraform-files.outputs.all_modified_files, 'infra/terraform/environments/prod') || null }} steps: - uses: actions/checkout@v4 with: diff --git a/app/cdn/.nvmrc b/app/cdn/.nvmrc deleted file mode 100644 index cc52a71cd7..0000000000 --- a/app/cdn/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v0.10.33 \ No newline at end of file diff --git a/app/cdn/LICENSE.txt b/app/cdn/LICENSE.txt deleted file mode 100644 index 45ae3015e1..0000000000 --- a/app/cdn/LICENSE.txt +++ /dev/null @@ -1 +0,0 @@ -The MIT License (MIT) Copyright (c) 2016 HM Government (Driver and Vehicle Standards Agency) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/app/cdn/README.md b/app/cdn/README.md deleted file mode 100644 index 5f5addc6b6..0000000000 --- a/app/cdn/README.md +++ /dev/null @@ -1,110 +0,0 @@ -#OLCS Static -### Synopsis -This repo contains the styleguides, prototypes and static assets for both the OLCS internal application and external service. - -To view the compiled end result, visit [http://olcs.github.io/olcs-static/](http://olcs.github.io/olcs-static/). - -### Change History -Updated for the OLCS Private Beta. For a detailed change log, see the file named [CHANGELOG.md](./CHANGELOG.md). - -### Known Issues -There are no known issues with the OLCS Static HTML. - -### Contributors -If you would like to send a bug report or contact us regarding any code-related queries please create an issue within the GitHub project. Valid reports and queries will receive responses within 60 days. - -### License -Copyright (c) 2016 HM Government (Driver and Vehicle Standards Agency) -Free software published under an MIT License - please see the file named [LICENSE.txt](./LICENSE.txt). - -### Acknowledgements -The following people created OLCS Static -* Edmund Reed -* Sam Quayle -* Nick Payne - -### Requirements for local install -Using a local container would usually be the preferred option, however instructions for a local install are below - -* [Node.js](https://nodejs.org/en/) v14 is the latest version that works -* [Python](https://www.python.org/) 2.7 is the latest version that works - -### Installation -* [install nvm](https://github.com/nvm-sh/nvm#installing-and-updating) -* nvm install 14 -* nvm use 14 - -Apple machines now ship with Python 3 -* [install python 2.7 (macbook tutorial)](https://dev.to/jordicuevas/how-to-install-python2-in-a-macbook-m1-with-brew-bhi) - -##### Clone the repo: - -``` -git clone https://github.com/OLCS/olcs-static.git -``` - -##### Install node modules: - -``` -npm install -``` - - -### Usage - -To view the compiled assets as well as continuously compile the assets as files are changed, you can run ` -npm run start` to compile the assets and styleguides, run the `watch` task, and set up a local server. - -Access the compiled styleguides: - -* [http://localhost:7001/styleguides/selfserve/](http://localhost:7001/styleguides/selfserve/) -* [http://localhost:7001/styleguides/selfserve/](http://localhost:7001/styleguides/internal/) - -### Developing - -#### JavaScript - -All JavaScript files are located within the `assets/_js` directory. This directory is further split up into the following directories: - -* [components](./tree/develop/assets/_js/components) (custom JS components) -* [init](./tree/develop/assets/_js/init) (initialise custom JS components) -* [vendor](./tree/develop/assets/_js/vendor) (third party JS) - -#### Sass/CSS - -All custom CSS is compiled from source *Scss* files which can be found in the `assets/_styles` directory. This directory is further split up into the following directories: - -* [components](./tree/develop/assets/_styles/components) (custom Sass components) -* [core](./tree/develop/assets/_styles/core) (core Sass components) -* [vendor](./tree/develop/assets/_styles/vendor) (thid party styles) -* [views](./tree/develop/assets/_styles/views) (styles for specific views) - -Desired partials are then imported into the appropriate theme to be processed. - -* [internal](./blob/develop/assets/_styles/themes/internal.scss) -* [selfserve](./blob/develop/assets/_styles/themes/selfserve.scss) - -### Build tasks - -OLCS uses NPM scripts and Grunt as the front end build tools, with all configuration being contained within `Gruntfile.js` & scripts in package.json. There are several pre-defined tasks which can be executed: - -``` -$ npm run start -``` -This is the main task used for development. It will compile all the assets and start a browsersync server & watch task to monitor and compile assets on the fly. -``` -$ npm run build:staging -``` -This is the task that Jenkins will run to build the static assets. It will lint javascript and run unit tests, compile CSS and JS and compile SVG icons/PNG fallback images. - -#### Unit testing - -You can run all unit tests by calling the grunt task: - -````$ grunt test```` - -Individual unit tests can be called with: - -````$ grunt test:single --target=componentName```` - -e.g. `grunt test:single --target=ajax` will only run ajax.test.js.