forked from publiclab/plots2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try splitting GitHub Actions into parallel jobs (publiclab#9001)
* Try splitting GitHub Actions into parallel jobs https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobs * fixed yml with `steps:` * Update continuous-integration.yml * Update continuous-integration.yml * Update and rename .github/workflows/continuous-integration.yml to .github/tests.yml * move setup out * Create setup-test-environment.yml * Update continuous-integration.yml * Rename .github/actions/setup-test-environment.yml to .github/actions/setup-test-environment/action.yml * Update continuous-integration.yml * Update continuous-integration.yml * Update and rename .github/continuous-integration.yml to .github/workflows/tests.yml * Update tests.yml * Update tests.yml * Update action.yml * Update tests.yml * remove gem installation steps as i believe they're done in ruby-setup * Update action.yml * Update tests.yml * add redis to functional tests * Update action.yml * add redis to system tests
- Loading branch information
1 parent
2c9e84e
commit 9f99388
Showing
3 changed files
with
133 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'Set up test environment' | ||
description: 'Set up test environment for plots2, except yarn' | ||
|
||
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_PASSWORD: root | ||
# tell Rails to use proper port for MySQL | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: | | ||
cp config/database.yml.example config/database.yml | ||
cp db/schema.rb.example db/schema.rb | ||
sudo systemctl start mysql | ||
mysql -uroot -proot -e "SET @@global.sql_mode=(SELECT REPLACE(@@global.sql_mode, 'ONLY_FULL_GROUP_BY', ''));" | ||
mysql -uroot -proot -e "CREATE DATABASE plots;" | ||
bundle exec rake db:schema:load db:migrate --trace | ||
# above SET @@global.sql_mode is to address issue in https://github.com/publiclab/plots2/issues/3120 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: tests | ||
on: [pull_request] | ||
jobs: | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 # Not needed with a .ruby-version file | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically (not working?) | ||
- uses: ./.github/actions/setup-test-environment | ||
- name: "Unit Tests" | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: bundle exec rails test test/unit | ||
|
||
functional-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.6 # Not needed with a .ruby-version file | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically (not working?) | ||
- uses: ./.github/actions/setup-test-environment | ||
- name: Install JavaScript dependencies with Yarn | ||
run: yarn check || yarn install; | ||
- name: "Functional Tests" | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: bundle exec rails test test/functional | ||
|
||
integration-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 # Not needed with a .ruby-version file | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically (not working?) | ||
- uses: ./.github/actions/setup-test-environment | ||
- 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] }} | ||
run: bundle exec rails test test/integration | ||
|
||
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.6 # Not needed with a .ruby-version file | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically (not working?) | ||
- uses: nanasess/[email protected] | ||
- uses: ./.github/actions/setup-test-environment | ||
- 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:system |