Commit Graph

102 Commits

Author SHA1 Message Date
Andrew Shumway
948ee68193 Added code coverage test to pipfile/makefile/workflow (#472)
Co-authored-by: stvnrlly <steven.reilly@gsa.gov>
2023-04-28 11:17:02 -04:00
Ryan Ahearn
80184a98fd Remove ignore-vulnerability line for remediated redis vuln 2023-03-29 16:55:42 -04:00
Ryan Ahearn
1fe0ad0d83 Ignore known issue with redis 4.5.3 2023-03-28 09:16:09 -04:00
Ryan Ahearn
703847e184 Respect HTTP_PROTOCOL config when forcing https 2023-03-08 10:48:22 -05:00
Ryan Ahearn
73a3511ef2 Remove uses of inline-styles 2023-03-08 09:08:07 -05:00
Ryan Ahearn
23f6f3c726 Report data to newrelic 2023-01-23 10:00:03 -05:00
Ryan Ahearn
197c17c1a9 Update pip-audit gh action 2023-01-03 09:59:27 -05:00
stvnrlly
e44fe2eb11 switch to pipenv 2022-11-08 09:44:09 -05:00
Ryan Ahearn
c045771b76 Run js-lint as part of the full test target 2022-10-27 16:01:54 +00:00
Ryan Ahearn
98b772f959 Separate test and lint steps 2022-10-27 11:10:13 -04:00
Ryan Ahearn
773cd99790 Only run pip-audit on runtime dependencies in CI 2022-10-19 10:39:46 -04:00
jimmoffet
3121e7bc47 update reqs to use GSA/notifications-utils 2022-09-06 18:34:30 -07:00
Ryan Ahearn
251ac133b5 Source nvmsh as part of a11y-scan 2022-09-02 13:29:56 -04:00
Ryan Ahearn
dfea3ac848 Install pa11y-ci 2022-08-30 10:37:33 -04:00
Ryan Ahearn
8b6210eedb Add python static scan task 2022-08-26 14:12:26 +00:00
Ryan Ahearn
fa7b1a41b8 Add python and npm audits to checks.yml 2022-08-25 16:55:33 -04:00
Ryan Ahearn
bdee795f56 Switch first nvm source to --no-use instead of --install 2022-08-09 09:23:47 -04:00
Ryan Ahearn
3ff922bb07 Source nvm from either $HOME or /usr/local/share 2022-08-08 14:43:13 -04:00
jimmoffet
dad051a662 2767 passing 2022-08-05 00:25:03 -07:00
Jim Moffet
e17c26d1f6 config buckets 2022-06-23 14:08:29 -07:00
Jim Moffet
18eefc87c0 clean makefile 2022-06-13 14:31:51 -07:00
Jim Moffet
2b727e13b4 local dev upgrades 2022-06-13 14:26:46 -07:00
Ben Thorner
b348e8ed03 Add better-npm-audit to check production packages
This is the same as [^1].

[^1]: https://github.com/alphagov/document-download-frontend/pull/120
2022-05-09 12:05:42 +01:00
Ben Thorner
d97ed69f0b Turn off NPM auditing on installation
This isn't useful as it mostly pertains to dev dependencies, where
we're not concerned about vulnerabilities as they run in isolation.
2022-05-06 12:31:52 +01:00
Richard Baker
799949a3f4 Add .nvmrc & use NVM to manage installed Node version
We have decided to use NVM to manage installed Node versions locally
and in CI to ensure they match and produce consistent builds.

Running `nvm install` will install the Node version specified in the
`.nvmrc` file.

This is now consistent with Document Download Frontend.
See: alphagov/document-download-frontend#114

Signed-off-by: Richard Baker <richard.baker@digital.cabinet-office.gov.uk>
2022-04-05 12:09:53 +01:00
Chris Hill-Scott
795fd8f91d Add Makefile command to watch for frontend changes
When editing CSS, Javascript or other assets it’s useful to not have to
run `gulp` manually to rebuild things after making changes.

This is why we have the `npm watch` script.

However for the paths to fonts to resolve properly when running locally
it needs the `NOTIFY_ENVIRONMENT` variable set to `development`. Having
to remember to do both of these steps every time is awkward.

For a one-off build of the frontend we added a command to set
`NOTIFY_ENVIRONMENT` to the appropriate value in https://github.com/alphagov/notifications-admin/pull/4049

This commit does the same thing for the watch task, by encapsulating
both steps in one `make` command.

Happy to take alternative suggestions on command naming.
2021-11-02 15:22:57 +00:00
Ben Thorner
1869f9a53a Fix static assets in development (again)
Previous attempt: https://github.com/alphagov/notifications-admin/pull/4048

The problem with the previous attempt is that the assets built on
CI become part of the build artefact used for production [1]. This
switches back to my original approach of using environment.sh, but
with a technique to cope with it being absent on CI. I've tested it
works with and without an environment.sh file.

Note that "npm install" is fine to be on a separate line, since a
non-zero exit code will always cause "make" to stop.

[1]: https://github.com/alphagov/notifications-aws/blob/master/concourse/templates/admin.yml.j2#L47
2021-10-19 11:08:17 +01:00
Ben Thorner
f8d97821a2 Fix broken CSS links to assets in development
This depends on an environment variable being set when the assets
are built in a development context [1]. Otherwise, the assets get
their '/static' prefix stripped like they do for production, which
isn't compatible with serving them under '/static' in development.

[1]: 66e5022198/gulpfile.js (L37-L41)
2021-10-18 17:32:28 +01:00
Chris Hill-Scott
5c94aa004e Remove deprecated command line flag to isort
> Prior to version 5.0.0, isort wouldn't automatically traverse directories. The --recursive option was necessary to tell it to do so. In 5.0.0 directories are automatically traversed for all Python files, and as such this option is no longer necessary and should simply be removed.

— https://github.com/PyCQA/isort/blob/main/docs/upgrade_guides/5.0.0.md#--recursive-or--rc

***

We moved to version `> 5.0.0` of isort in March 2021: https://github.com/alphagov/notifications-admin/pull/3828/files
2021-10-04 14:58:29 +01:00
Tom Byers
5115344927 Remove rebuild of node-sass from bootstrap
We now use `sass`, a JavaScript version of Sass,
compiled from dart-sass*, so shouldn't need to
rebuild it to solve issues with C libraries.

*https://github.com/sass/dart-sass
2021-09-22 12:05:48 +01:00
Ben Thorner
ca9c28d08f Merge pull request #3897 from alphagov/remove-run-tests
Run tests directly from the Makefile
2021-06-16 14:02:44 +01:00
David McDonald
f4dc9e15e1 Add help text for new make steps
Helpful for when you run `make` as you've forgotten what the command is
and you don't want to go find the readme
2021-05-25 11:21:39 +01:00
Ben Thorner
66ffc0e29b Run tests directly from the Makefile
Depends on: https://github.com/alphagov/notifications-aws/pull/905

Previously this would print some custom text with each step, and
as optionally loading a virtual environment. This moves the actual
test commands to the Makefile. While this no longer prints custom
text, it does print the command that was run:

Before (skipping other output):

  ./scripts/run_tests.sh
  Code style check passed
  Import order check passed
  ...
  JavaScript tests have passed
  ...
  Unit tests have passed

After (skipping other output):

  flake8 .
  isort --check-only ./app ./tests
  npm test
  ...
  py.test -n auto --maxfail=10 tests/
  ...

I think it's more useful to see the command being run, rather than
having to wait until it succeeds to know what was happening. Having
the command also makes it easier to run it again if it fails, rather
than having to go and find it in a script.
2021-05-24 15:39:36 +01:00
Leo Hemsted
5d2b18e501 bump pip-tools when freezing dependencies
to stop big diffs from change in formatting of reqs.txt
2021-04-08 11:09:39 +01:00
Ben Thorner
c5e528efa2 Fix typo in Makefile (not running 'npm install') 2021-02-26 17:54:43 +00:00
Ben Thorner
86929df84e Remove other unused rules in Makefile
These aren't referenced anywhere. Some are repeated in other rules,
and if necessary it should be easy to type the commands.
2021-02-22 17:21:01 +00:00
Ben Thorner
c1cbd9c34a Remove redundant parts of the README
These aren't specific to this repo, and are covered more generally
in the Wiki [1]. Note that:

- The claim about needing multiple Python versions is not true.
- The NPM instructions should be covered by the "make bootstrap".
- The version of Node/NPM is covered by installing the latest one.

[1]: https://github.com/alphagov/notifications-manuals/wiki/Getting-Started
2021-02-22 17:04:41 +00:00
Ben Thorner
dfb767d57e Move bootstrap tasks into the Makefile
This is more consistent with how we run all other tasks. Note that
the virtual env setup is not generally applicable, and developers
of this repo should follow the guidance in the README.
2021-02-22 16:53:54 +00:00
Ben Thorner
36a806e8bf Switch to 'make' for running app processes
These are simple enough that they don't need their own scripts.
2021-02-22 16:41:30 +00:00
Ben Thorner
2af1d6f159 iRemove redundant Docker tasks
Nothing and no one uses these.
2021-02-22 16:38:27 +00:00
Ben Thorner
627e4e41ab Stop locking non-test dependencies twice
Currently we have a situation where we're not running tests against
new versions of dependencies, as requirements_for_test.txt is not
being kept in-sync with requirements.txt by pyup. Deploys are only
working because Concourse silently ignores version issues.

From a deployment log:

awscli 1.18.211 has requirement PyYAML<5.4,>=3.10; python_version != "3.4", but you'll have pyyaml 5.4 which is incompatible.

This switches to a single requirements file for test dependencies,
in order to keep it in-sync with requirements.txt i.e. we run our
tests against the same versions of dependencies that we deploy with,
and the build fails if we try to use package versions that are not
mutually compatible, as this example PR shows [1].

ERROR: Cannot install -r requirements_for_test.txt (line 17), -r requirements_for_test.txt (line 198) and pyyaml==5.4.1 because these package versions have conflicting dependencies.

We shouldn't need to have fine-grained locking on test dependencies,
beyond those we want to list manually in the file.

[1]: https://github.com/alphagov/notifications-admin/pull/3804
2021-02-16 18:09:47 +00:00
Chris Hill-Scott
54d3d0421b Restore and add comments 2021-01-08 17:02:39 +00:00
Chris Hill-Scott
8b1e4afd3b Install pip tools as part of freeze-requirements
Makes the command faster and more self contained.
2021-01-08 17:02:39 +00:00
Chris Hill-Scott
0f68d25265 Replace custom pip freeze script with pip-tools
In the past we've avoided using out-of-the-box solutions for Python
dependency resolution because a) they haven't been very mature and b)
we've had lots of issues with version conflicts. See [[1]], [[2]] for
details. Instead, we've been using a custom Python script that
under-the-hood runs `pip freeze` and saves the output to
`requirements.txt`.

This script works well for us, but it doesn't integrate well with other
tools. On the other hand [`pip-tools`](https://github.com/jazzband/pip-tools)
as of 2020 seems to be well-supported by its maintainers and other
tools; for instance, GitHub's automated update service
[Dependabot](https://dependabot.com) supports `requirements.in` files.

This commit replaces our `freeze-requirements` make command with
`pip-compile`.

The Digital Marketplace team have made this change and seem happy with
the results.
2021-01-08 17:02:39 +00:00
David McDonald
36fa31563d Use cf7 commands for the cf CLI commands
As we want to upgrade from cf6 to cf7 CLI
2020-12-08 17:59:25 +00:00
Pea Tyczynska
652b627312 Update healthcheck page and remove all travis references from the repository 2020-04-24 11:54:26 +01:00
Leo Hemsted
7df45d6cce bump deployment timeout
5 minutes isn't long enough to deploy ten instances of the admin app -
it turns out it takes marginally longer than 5 minutes to roll each
instance one after the next. this can lead to confusion as the build
fails, functional tests don't run, but the code may have deployed fine
and be running on production.
2020-03-23 14:38:01 +00:00
David McDonald
d3c8b35aa9 Rearrange makefile 2020-03-03 12:05:56 +00:00
David McDonald
162734c7a7 Remove unused makefile commands
These are either not used at all or we have superseeded them with
commands written directly into concourse jobs
2020-03-03 12:05:15 +00:00
David McDonald
aa9446f752 Remove jenkins related code 2020-03-03 12:04:32 +00:00