diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b047609..c544b39e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,4 +11,4 @@ jobs: key: bundle-${{ hashFiles('**/Gemfile.lock') }} restore-keys: bundle - run: bundle install --jobs 4 --retry 3 --deployment - - run: GOVUK_DOCKER_DIR=. make lint test + - run: GOVUK_DOCKER_DIR=. make test-ci diff --git a/Brewfile b/Brewfile index 59a39270..31ce746a 100644 --- a/Brewfile +++ b/Brewfile @@ -1,5 +1,4 @@ brew "dnsmasq" -brew "rbenv" brew "pv" brew "shellcheck" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66d6be4d..0398cf28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,20 +4,22 @@ Contributions welcome - just raise a PR and make sure the tests pass! ## Testing -**First make sure you have the following dependencies.** +GOV.UK Docker tests are written in Ruby / RSpec. Just like any other Ruby project, we have a `govuk-docker-lite` stack for running the tests, using GOV.UK Docker. -- [rbenv](https://github.com/rbenv/rbenv#installation) - -**Next install Ruby / dependencies and run all the tests.** +Do this the first time you run the tests: ```sh -rbenv install +make govuk-docker +``` -bundle install +Do this to run the tests for GOV.UK Docker: -make test +```sh +make test-local ``` +This will also run checks on scripts and config files in this repo. Since these checks require access to your local machine, they are not run using GOV.UK Docker. + ## Versioning GOV.UK Docker is [versioned][version] in order to notify users about important changes, where they may need to take action. Since we use the repo itself for distributing GOV.UK Docker, for many PRs it's unlikely you will need to change the version. diff --git a/Makefile b/Makefile index 5398ded5..2e65749b 100644 --- a/Makefile +++ b/Makefile @@ -13,14 +13,15 @@ default: @echo "For example:" @echo " make content-publisher" -lint: - # Lint the ruby code - bundle exec rubocop +test-local: test-scripts + $(GOVUK_DOCKER) run govuk-docker-lite bundle exec rubocop + $(GOVUK_DOCKER) run govuk-docker-lite bundle exec rspec -test: - # Run the tests for the govuk-docker CLI +test-ci: test-scripts + bundle exec rubocop bundle exec rspec +test-scripts: # Test that the docker-compose config is valid. This will error if there are errors # in the YAML files, or incompatible features are used. $(GOVUK_DOCKER) config > /dev/null diff --git a/README.md b/README.md index 27e7ce41..d2607b33 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ Run `echo $SHELL` if you're not sure which shell you use. After saving, you will ``` git clone git@github.com:alphagov/govuk-docker.git cd govuk-docker -bundle install bin/setup ``` diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 9aeda674..08ab2c49 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -15,12 +15,27 @@ ssh_username: "yourname" ## Diagnose common issues when setting up GOV.UK Docker -Run the following command in `~/govuk/govuk-docker`. Since this script makes use of Ruby Gems, you will need to [install some additional dependencies](../CONTRIBUTING.md#testing) in order to do this. +Run the following command in `~/govuk/govuk-docker`. ``` bin/doctor ``` +Since this script makes use of Ruby Gems, you will need to install some additional dependencies in order to do this. + + +First make sure you have the following dependencies: + +- [rbenv](https://github.com/rbenv/rbenv#installation) + +Next install Ruby / dependencies and run all the tests: + +```sh +rbenv install + +bundle install +``` + ## Diagnose database issues with a project/app not making If you run `make` on an app inside govuk-docker and face any of the following database issues: diff --git a/projects/generic-ruby-library/Makefile b/projects/generic-ruby-library/Makefile index eef03811..db1f3fc7 100644 --- a/projects/generic-ruby-library/Makefile +++ b/projects/generic-ruby-library/Makefile @@ -3,3 +3,4 @@ govspeak: bundle-govspeak govuk_app_config: bundle-govuk_app_config plek: bundle-plek smokey: bundle-smokey +govuk-docker: bundle-govuk-docker diff --git a/projects/generic-ruby-library/docker-compose.yml b/projects/generic-ruby-library/docker-compose.yml index a2e4559e..28869682 100644 --- a/projects/generic-ruby-library/docker-compose.yml +++ b/projects/generic-ruby-library/docker-compose.yml @@ -22,6 +22,10 @@ services: <<: *generic-ruby-library working_dir: /govuk/govuk_app_config + govuk-docker-lite: + <<: *generic-ruby-library + working_dir: /govuk/govuk-docker + plek-lite: <<: *generic-ruby-library working_dir: /govuk/plek