Commit Graph

111 Commits

Author SHA1 Message Date
Steven Reilly
9fc44a352b Merge branch 'main' into notify-api-387 2023-08-22 17:45:04 -04:00
Kenneth Kehl
621c381de8 add dead code command to Makefile 2023-08-08 13:16:20 -07:00
Kenneth Kehl
d36c70ed16 notify-api-387 scan projects for unused code 2023-08-08 12:12:15 -07:00
Kenneth Kehl
b92f386290 notify-api-387 scan projects for unused code 2023-08-08 11:00:09 -07:00
Kenneth Kehl
4dd3679c4f change failure to be C, D, or F 2023-08-07 10:58:32 -07:00
Kenneth Kehl
1ddc821dd1 notify-api-386 scan projects for code complexity 2023-08-07 10:41:07 -07:00
Steven Reilly
eec2caa6e4 Merge branch 'main' into notify-admin-638 2023-07-28 11:04:45 -04:00
Carlo Costino
b5664c3d20 Add support for E2E (end-to-end) tests (#625)
This changeset lays the foundation for supporting E2E (end-to-end) integration tests for US Notify.  It brings in the Playwright testing framework along with the Playwright pytest plugin to make this possible, and includes the following adjustments:

- A new test session fixture for ensuring that Playwright authenticates with the sites that are currently behind HTTP Auth (requies env-var config)
- A new end_to_end test directory specifically for E2E tests
- Updates to the Makefile that make sure E2E tests are not run as a part of the normal test routine but can be run separately
- A new command in the Makefile to run E2E tests that will run in Chromium, Firefox, and Webkit headless browsers

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-07-28 09:31:45 -04:00
Kenneth Kehl
6188f7bc74 notify-admin-638 adjust coverage report to fail under 96% 2023-07-20 13:20:22 -07:00
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