Try out parallel Travis builds (#6645)

* Try out parallel Travis builds

* Add more Bundler options

* Appease the spec gods

I don't think we actually need Timecop.freeze in this spec

* Try inlining factories

* Make sure the time has actually changed

* Add CodeClimate coverage for parallel build

* Explicitly list jobs, don't rely on matrix expansion

* Merge master and move storybook to after_script

* Add missing environment variable

* Remove old cc-test-reporter config

* Move yarn build-storybook back to script, remove conditional coverage upload

* Actually remove yarn build-storybook from after_script

* Bump Octokit so we can build again

Co-authored-by: rhymes <rhymesete@gmail.com>
This commit is contained in:
Michael Kohl 2020-04-14 21:25:53 +07:00 committed by GitHub
parent b51852e866
commit 4f68e1907e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 12 deletions

View file

@ -21,6 +21,7 @@ env:
- RAILS_ENV=test
- CC_TEST_REPORTER_ID=f39e060a8b1a558ebd8aff75d5b9760bf1ae98f3f85d628ae28814f3c66438cd
- DATABASE_URL=postgres://postgres@localhost/
- CI_NODE_TOTAL=2
# Dummy values needed to verify the app boots via "rails runner"
- APP_PROTOCOL=http://
- APP_DOMAIN=localhost:3000
@ -30,6 +31,14 @@ env:
- SENDGRID_PASSWORD_ACCEL=dummy
- HEROKU_APP_URL=practicaldev.herokuapp.com
- SECRET_KEY_BASE=dummydummydummy
jobs:
include:
- env:
- RSPEC_TAG="~type:system"
- CI_NODE_INDEX=0
- env:
- RSPEC_TAG="type:system"
- CI_NODE_INDEX=1
branches:
only:
- master
@ -44,8 +53,10 @@ before_install:
- echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlog4j.skipJansi=true\n-server\n' | sudo tee -a /etc/elasticsearch/jvm.options
- sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
- sudo systemctl start elasticsearch
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
install:
- bundle install --path vendor/bundle
- bundle install --jobs=3 --retry=3 --path vendor/bundle
- yarn install
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
> ./cc-test-reporter
@ -56,16 +67,15 @@ script:
- bundle exec rails webpacker:compile
- bundle exec rails db:schema:load
- './cc-test-reporter before-build'
- 'bundle exec rspec spec --color --tty'
- 'bundle exec rspec spec --color --tty --tag ${RSPEC_TAG}'
- '[ ! -f .approvals ] || bundle exec approvals verify --ask false'
- './cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.simplecov.json'
- 'yarn test --colors'
- './cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.lcov.json'
- './cc-test-reporter sum-coverage coverage/codeclimate.*.json'
- './cc-test-reporter upload-coverage'
- 'bundle exec bundle-audit check --update --ignore CVE-2015-9284'
- yarn build-storybook
- bundle exec rails runner -e production 'puts "App booted successfully"'
after_script:
- ./cc-test-reporter format-coverage -t simplecov -o ./coverage/codeclimate.$CI_NODE_INDEX.json ./coverage/spec/.resultset.json
- ./cc-test-reporter sum-coverage --output - --parts $CI_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
deploy:
provider: heroku
api_key: '$HEROKU_AUTH_TOKEN'

View file

@ -7,17 +7,17 @@ RSpec.describe Users::ResaveArticlesWorker, type: :worker do
let(:worker) { subject }
context "with user" do
let_it_be(:user) { create(:user) }
let_it_be(:article) { create(:article, user: user) }
it "resave articles" do
user = create(:user)
article = create(:article, user: user)
old_updated_at = article.updated_at
Timecop.freeze(Time.current) do
Timecop.travel(1.minute.from_now) do
worker.perform(user.id)
expect(article.reload.updated_at > old_updated_at).to be(true)
end
expect(article.reload.updated_at).to be > old_updated_at
end
end