Skip to content

Merge pull request #2003 from tf/rails-6-entry-types #1205

Merge pull request #2003 from tf/rails-6-entry-types

Merge pull request #2003 from tf/rails-6-entry-types #1205

Workflow file for this run

name: tests
on: [push, pull_request]
env:
RAILS_ENV: test
PAGEFLOW_DB_HOST: 127.0.0.1
jobs:
rspec:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- engine-name: pageflow
ruby-version: 2.6
engine-directory: .
rspec-command: bin/rspec --tag ~js
install-audiowaveform: true
- engine-name: pageflow
ruby-version: 3.2
rails-version: "~> 6.1"
engine-directory: .
rspec-command: bin/rspec --tag ~js
install-audiowaveform: true
- engine-name: pageflow
ruby-version: 2.6
engine-directory: .
rspec-command: bin/rspec-with-retry --tag js
- engine-name: pageflow
ruby-version: 3.2
rails-version: "~> 6.1"
engine-directory: .
rspec-command: bin/rspec-with-retry --tag js
- engine-name: pageflow_paged
ruby-version: 2.6
engine-directory: entry_types/paged
plugin-name: pageflow_paged
rspec-command: bin/rspec
- engine-name: pageflow_scrolled
ruby-version: 2.6
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec --tag ~js
- engine-name: pageflow_scrolled
ruby-version: 3.2
rails-version: "~> 6.1"
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec --tag ~js
- engine-name: pageflow_scrolled
ruby-version: 2.6
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec-with-retry-on-timeout --tag js
- engine-name: pageflow_scrolled
ruby-version: 3.2
rails-version: "~> 6.1"
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec-with-retry-on-timeout --tag js
env:
PAGEFLOW_RAILS_VERSION: ${{ matrix.rails-version }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
# Set health checks to wait until mysql has started
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries 5
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
steps:
- uses: actions/checkout@v2
# Caching
- name: Set up cache for Bundler
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Set up cache for Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Ruby/Node
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
# Dependencies
- name: Install audiowaveform package
if: ${{ matrix.install-audiowaveform == true}}
run: |
sudo add-apt-repository ppa:chris-needham/ppa
sudo apt-get update
sudo apt-get install audiowaveform
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Yarn install
run: |
yarn install
# Build
- name: Build packages
run: |
bin/build-packages
- name: Generate dummy app
working-directory: ${{ matrix.engine-directory }}
env:
PAGEFLOW_PLUGIN_ENGINE: ${{ matrix.plugin-name }}
run: |
bin/rake ${{ matrix.engine-name }}:dummy
- name: Precompile
working-directory: ${{ matrix.engine-directory }}
run: |
WEBPACKER_PRECOMPILE=false SHAKAPACKER_PRECOMPILE=false bin/rake app:assets:precompile
# Test
- name: Run tests
working-directory: ${{ matrix.engine-directory }}
run: ${{ matrix.rspec-command }}
jest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: pageflow
package-directory: package
- name: pageflow-paged
package-directory: entry_types/paged/packages/pageflow-paged
- name: pageflow-paged-react
package-directory: entry_types/paged/packages/pageflow-paged-react
- name: pageflow-scrolled
package-directory: entry_types/scrolled/package
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Set up cache for Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
- name: Yarn install
run: |
yarn install
(cd entry_types/paged/packages/pageflow-paged-react; yarn install)
- name: Build packages
run: |
yarn run build
- name: Run ${{ matrix.name }} tests
working-directory: ${{ matrix.package-directory }}
run: |
yarn test
trigger-edge-build:
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'codevise/pageflow' }}
runs-on: ubuntu-latest
steps:
- name: Trigger GitLab workflow
run: |
curl -X POST \
-F token=${{ secrets.GITLAB_WORKFLOW_TRIGGER_TOKEN }} \
-F ref=master \
https://gitlab.codevise.de/api/v4/projects/180/trigger/pipeline