diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec646510544..c6e991a39d2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,10 @@ variables: - bundle check || bundle install --deployment --jobs=4 --retry=3 --without deploy development doc production --path vendor/ruby .yarn_install: &yarn_install - - yarn install --ignore-engines --cache-folder .yarn-cache + - yarn install --frozen-lockfile --ignore-engines --cache-folder .yarn-cache + +.yarn_production_install: &yarn_production_install + - yarn install --production --frozen-lockfile --ignore-engines --cache-folder .yarn-cache cache: - &ruby_cache @@ -31,9 +34,19 @@ cache: - .yarn-cache/ policy: pull + - &yarn_production_cache + key: + files: + - yarn.lock + paths: + - .yarn-cache/ + policy: pull + - &assets_cache key: $CI_COMMIT_SHA paths: + - tmp/cache/webpacker/last-compilation-digest-test + - tmp/cache/assets - public/assets - public/packs - public/packs-test @@ -93,6 +106,7 @@ specs: AWS_SECRET_ACCESS_KEY: test CAPYBARA_WAIT_TIME_SECONDS: 5 COVERAGE: 'true' + DOCKER_DB_HOST: postgres POSTGRES_DB: upaya_test POSTGRES_USER: postgres_user POSTGRES_PASSWORD: postgres_password @@ -124,12 +138,24 @@ specs: - cp -a keys.example keys - cp -a certs.example certs - cp pwned_passwords/pwned_passwords.txt.sample pwned_passwords/pwned_passwords.txt + - "echo -e \"test:\n redis_url: 'redis://redis:6379/0'\n redis_throttle_url: 'redis://localhost:6379/1'\" > config/application.yml" - bundle exec rake db:create db:migrate --trace - bundle exec rake db:seed - > ruby -i -pe 'gsub(/^(\s+)compile: true$/, "\\1compile: false")' config/webpacker.yml - bundle exec rake knapsack:rspec +js_build: + extends: .on_push + stage: test + cache: + - <<: *ruby_cache + - <<: *yarn_production_cache + script: + - *bundle_install + - *yarn_production_install + - bundle exec rake assets:precompile + js_tests: extends: .on_push stage: test