Just like we used to do with Travis. The configuration was taken from the Knapsack Pro documentation [1]. [1] https://docs.knapsackpro.com/2019/github-actions-ci-config-for-ruby-on-rails-project-with-mysql-redis-elasticsearch-how-to-run-parallel-tests
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
name: Test suite
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches-ignore:
|
|
- i18n_master
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-18.04
|
|
services:
|
|
postgres:
|
|
image: postgres:10.10
|
|
ports: ["5432:5432"]
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
env:
|
|
POSTGRES_USER: consul
|
|
POSTGRES_PASSWORD: ""
|
|
env:
|
|
PGUSER: consul
|
|
POSTGRES_HOST: postgres
|
|
RAILS_ENV: test
|
|
COVERALLS: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
ci_node_total: [5]
|
|
ci_node_index: [0, 1, 2, 3, 4]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
bundler-cache: true
|
|
- name: Setup NPM
|
|
uses: actions/setup-node@v1
|
|
- name: Copy secrets and database files
|
|
run: for i in config/*.example; do cp "$i" "${i/.example}"; done
|
|
- name: Setup database
|
|
run: bundle exec rake db:setup
|
|
- name: Compile assets
|
|
run: bundle exec rake assets:precompile > /dev/null 2>&1
|
|
- name: Run test suite
|
|
env:
|
|
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
|
|
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
|
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
|
KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
|
|
KNAPSACK_PRO_LOG_LEVEL: info
|
|
run: bin/knapsack_pro_rspec
|