-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from Travis to GitHub Actions for CI #1534
Changes from all commits
65ad6f0
d83a53d
e681180
1e59560
6650c8d
b6d31d6
f922988
b4510df
116f082
b73093c
9ac7c92
10b4b10
00761d5
e6a8f30
0bd0169
ff1e1e5
998b294
dd3d6cd
b2533ee
2373b44
33e96a0
4b76acc
39dce52
10cb4cd
8eb9af7
ce1621e
0f35f7b
5ff5712
bd3fab8
9a28b51
7daffb1
6698c28
2739b30
d7df220
2e79956
ab16ea7
b3c36a7
bf44440
c157cec
c9e913b
7892471
9f069ab
38f3d36
1af307c
31d3d08
d6a0287
8e6243a
3858156
d6e3711
2a496a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
version: 2 | ||
plugins: | ||
rubocop: | ||
enabled: true | ||
channel: rubocop-0-70 | ||
brakeman: | ||
enabled: true | ||
bundler-audit: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: 'Set up test environment' | ||
description: 'Set up test environment for mapknitter' | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
ports: | ||
- 3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Setup database | ||
shell: bash | ||
env: | ||
RAILS_ENV: test | ||
DB_USER: root | ||
DB_PASS: root | ||
# tell Rails to use proper port for MySQL | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
DISABLE_BOOTSNAP: true | ||
run: | | ||
cp config/database.yml.example config/database.yml | ||
cp db/schema.rb.example db/schema.rb | ||
cp config/config.yml.example config/config.yml | ||
sudo systemctl start mysql | ||
mysql -uroot -proot -e "CREATE DATABASE mapknitter_test;" | ||
bundle exec rake db:schema:load db:migrate --trace | ||
sudo apt-get install -y gdal-bin | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
name: CI/CD workflow | ||
on: [pull_request] | ||
|
||
jobs: | ||
rubocop: | ||
name: Code style suggestions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Prepare Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- name: Rubocop report | ||
env: | ||
FORCE_COLOR: 1 | ||
run: bundle exec rubocop --color --fail-fast | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- uses: ./.github/actions/setup-test-environment | ||
- uses: egordm/gha-yarn-node-cache@v1 | ||
- name: Install packages | ||
run: yarn install | ||
- name: 'Model Tests' | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
DISABLE_BOOTSNAP: true | ||
run: | | ||
bundle exec rails test test:models | ||
|
||
integration-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- uses: ./.github/actions/setup-test-environment | ||
- uses: egordm/gha-yarn-node-cache@v1 | ||
- name: Install JavaScript dependencies with Yarn | ||
run: yarn check || yarn install; | ||
- name: 'Integration Tests' | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
DISABLE_BOOTSNAP: true | ||
run: bundle exec rails test test:integration | ||
|
||
controller-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- uses: ./.github/actions/setup-test-environment | ||
- uses: egordm/gha-yarn-node-cache@v1 | ||
- name: Install JavaScript dependencies with Yarn | ||
run: yarn check || yarn install; | ||
- name: 'Controller Tests' | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
DISABLE_BOOTSNAP: true | ||
run: bundle exec rails test test:controllers | ||
|
||
system-tests: | ||
runs-on: ubuntu-latest | ||
services: | ||
redis: | ||
image: redis | ||
# Set health checks to wait until redis has started | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps port 6379 on service container to the host | ||
- 6379:6379 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- uses: nanasess/[email protected] | ||
- uses: ./.github/actions/setup-test-environment | ||
- uses: egordm/gha-yarn-node-cache@v1 | ||
- name: Install JavaScript dependencies with Yarn | ||
run: yarn check || yarn install; | ||
- name: 'System Tests' | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
REDIS_HOST: localhost | ||
REDIS_PORT: 6379 | ||
run: | | ||
export DISPLAY=:99 | ||
chromedriver --url-base=/wd/hub & | ||
bundle exec rails test test:system | ||
- name: Archive system test screenshots | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: system-test-screenshots | ||
path: tmp/screenshots/* | ||
|
||
docker-build-check-development: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- uses: ./.github/actions/setup-test-environment | ||
- name: 'Development Docker Build' | ||
run: docker build -t mapknitter -f dockerfiles/development . | ||
|
||
docker-build-check-production: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- uses: ./.github/actions/setup-test-environment | ||
- name: 'Development Docker Build' | ||
run: docker build -t mapknitter -f dockerfiles/production . | ||
|
||
assets-precompilation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4.6 | ||
bundler-cache: true | ||
- uses: ./.github/actions/setup-test-environment | ||
- uses: egordm/gha-yarn-node-cache@v1 | ||
- name: Install JavaScript dependencies with Yarn | ||
run: yarn check || yarn install; | ||
- name: 'Asset Precompilation' | ||
env: | ||
RAILS_ENV: production | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
DISABLE_BOOTSNAP: true | ||
run: bundle exec rails assets:precompile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
require: rubocop-rails | ||
require: rubocop-performance | ||
|
||
# Start with Spotifys style guide as a base then customize from there | ||
inherit_from: | ||
- .rubocop_shopify_styleguide.yml | ||
- .rubocop_todo.yml | ||
|
||
inherit_gem: | ||
rubocop-shopify: rubocop.yml | ||
|
||
# Apply rule to all cops | ||
AllCops: | ||
Include: | ||
- '*/**/*.rb' | ||
- '/Rakefile' | ||
- '/config.ru' | ||
Exclude: | ||
- 'vendor/*' | ||
- 'vendor/**/*' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line did the trick! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Except that I know have errors in code climate 🌦️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oof wow that was obscure! Glad you're figuring it out though! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, i see:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't CodeClimate just running rubocop? So maybe we just need one or the other. Rubocop's job ran fine!
Gosh surprising that this is a lot more complex seeming than our other Rails repos. I guess the setup is relatively different? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, I removed the rubocop plugin from codeclimate as it is in GH Actions now. |
||
- 'node_modules/**/*' | ||
- 'spec/**/*' | ||
- 'bin/*' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, apparently, only this package is needed to run unit and integration tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's right - i think we do unit and integration tests which run map exporting processes, but we didn't bother to do that for other kinds of tests which are more focused on application logic rather than these big back-end processes.