Merge pull request #1985 from tf/bullet-color #1137
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
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 | |
engine-directory: . | |
rspec-command: bin/rspec --tag ~js | |
install-audiowaveform: true | |
- engine-name: pageflow | |
engine-directory: . | |
rspec-command: bin/rspec-with-retry --tag js | |
- engine-name: pageflow_paged | |
engine-directory: entry_types/paged | |
plugin-name: pageflow_paged | |
rspec-command: bin/rspec | |
- engine-name: pageflow_scrolled | |
engine-directory: entry_types/scrolled | |
plugin-name: pageflow_scrolled | |
rspec-command: bin/rspec --tag ~js | |
- engine-name: pageflow_scrolled | |
engine-directory: entry_types/scrolled | |
plugin-name: pageflow_scrolled | |
rspec-command: bin/rspec-with-retry-on-timeout --tag js | |
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 }}-gems-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }} | |
restore-keys: | | |
${{ runner.os }}-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 2.6 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- 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 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 |