2021-02-17 19:06:55 +01:00
|
|
|
name: Continuous Integration
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: 'main'
|
|
|
|
pull_request:
|
|
|
|
branches: 'main'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linters:
|
|
|
|
name: Linters
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Ruby
|
|
|
|
uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
bundler-cache: true
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
2021-10-26 13:07:42 +02:00
|
|
|
cache: yarn
|
|
|
|
|
|
|
|
- name: Install node modules
|
|
|
|
run: yarn install --frozen-lockfile
|
2021-02-17 19:06:55 +01:00
|
|
|
|
|
|
|
- name: Run linters
|
|
|
|
run: |
|
|
|
|
bundle exec rake lint
|
|
|
|
|
|
|
|
tests:
|
|
|
|
name: Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:12
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: tps_test
|
|
|
|
POSTGRES_DB: tps_test
|
|
|
|
POSTGRES_PASSWORD: tps_test
|
|
|
|
ports: ["5432:5432"]
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
pattern:
|
2021-04-15 13:06:43 +02:00
|
|
|
- bin/rake zeitwerk:check
|
2021-10-26 14:01:56 +02:00
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=0 -split-total=6)
|
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=1 -split-total=6)
|
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=2 -split-total=6)
|
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=3 -split-total=6)
|
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=4 -split-total=6)
|
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=5 -split-total=6)
|
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/system/**/*_spec.rb' -split-index=0 -split-total=2)
|
|
|
|
- bin/rspec $(./split_tests -line-count -glob='spec/system/**/*_spec.rb' -split-index=1 -split-total=2)
|
2021-02-17 19:06:55 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Ruby
|
|
|
|
uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
bundler-cache: true
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
2021-10-26 13:07:42 +02:00
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Install Node modules
|
|
|
|
run: yarn install --frozen-lockfile
|
2021-02-17 19:06:55 +01:00
|
|
|
|
2021-10-26 14:01:56 +02:00
|
|
|
- name: Setup split_tests binary
|
|
|
|
run: |
|
|
|
|
curl --no-progress-meter -L https://github.com/leonid-shevtsov/split_tests/releases/download/v0.3.0/split_tests.linux.gz | gunzip -c > split_tests
|
|
|
|
chmod +x split_tests
|
|
|
|
|
2021-02-17 19:06:55 +01:00
|
|
|
- name: Setup test database
|
|
|
|
env:
|
|
|
|
RAILS_ENV: test
|
|
|
|
DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test"
|
|
|
|
run: |
|
2021-10-26 13:27:26 +02:00
|
|
|
bin/rails db:create db:schema:load db:migrate
|
2021-02-17 19:06:55 +01:00
|
|
|
|
2021-04-15 13:06:43 +02:00
|
|
|
- name: Setup environment variables
|
|
|
|
run: |
|
|
|
|
cp config/env.example .env
|
|
|
|
|
2021-10-26 14:34:11 +02:00
|
|
|
- name: Assets cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
public/assets
|
|
|
|
public/packs-test
|
|
|
|
tmp/cache/webpacker
|
|
|
|
key: asset-cache-${{ runner.os }}-${{ github.ref }}-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
asset-cache-${{ runner.os }}-${{ github.ref }}-${{ github.sha }}
|
|
|
|
asset-cache-${{ runner.os }}-${{ github.ref }}-
|
|
|
|
asset-cache-${{ runner.os }}-
|
|
|
|
|
|
|
|
- name: Precompile assets
|
|
|
|
env:
|
|
|
|
RAILS_ENV: test
|
|
|
|
run: |
|
2021-10-26 14:35:18 +02:00
|
|
|
rm bin/yarn
|
2021-10-26 14:34:11 +02:00
|
|
|
bin/rails assets:precompile --trace
|
|
|
|
|
2021-02-17 19:06:55 +01:00
|
|
|
- name: Run tests
|
2021-04-15 13:06:43 +02:00
|
|
|
run: ${{ matrix.pattern }}
|