Skip to content

Commit

Permalink
Stop compiling assets outside production
Browse files Browse the repository at this point in the history
If we use `bin/rails spec` to run our specs in CI we will not need to
compile the assets - this should save some time building the image for
CI.

The reason is that the `spec` task includes `test:prepare` which builds
the assets in test.
  • Loading branch information
mec committed Nov 21, 2024
1 parent cd9998f commit a5a5ffd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
name: Run Rspec and Simplebcov
run: |
docker compose -p app_test -f docker-compose.ci.yml \
run --name app_test test /bin/bash -c "bin/rspec --format=documentation"
run --name app_test test /bin/bash -c "bin/rails spec"
-
name: Shutdown containers
run: docker compose -p app_test down && docker compose -p app_test rm
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--require spec_helper
--require rails_helper
--format documetnation
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,9 @@ COPY . ${APP_HOME}
RUN cp -R $DEPS_HOME/node_modules $APP_HOME/node_modules
RUN cp -R $DEPS_HOME/node_modules/govuk-frontend/govuk/assets $APP_HOME/app/assets

RUN \
RAILS_ENV=$RAILS_ENV \
DOMAIN="stand-in.local" \
SECRET_KEY_BASE="super secret" \
DATABASE_URL="postgres://stand-in:5432" \
REDIS_URL="redis://stand-in.local:6379" \
bundle exec rake assets:precompile --quiet
RUN if [ ${RAILS_ENV} = "production" ]; then \
bundle exec rake assets:precompile --quiet; \
fi

# create tmp/pids
RUN mkdir -p tmp/pids
Expand Down

0 comments on commit a5a5ffd

Please sign in to comment.