Skip to content

pawoo-test

pawoo-test #70

Workflow file for this run

name: pawoo-test
on:
push:
branches:
- master
pull_request:
schedule:
- cron: "0 0 * * 1" # JST 9:00 (Mon)
env:
CI: "true"
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.2
env:
POSTGRES_USER: root
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:3.2.4
ports:
- 6379:6379
options: --health-cmd "redis-cli -h localhost ping" --health-interval 10s --health-timeout 5s --health-retries 15
container:
image: ruby:2.6.9-buster
env:
DB_HOST: postgres
DB_USER: root
REDIS_HOST: redis
LOCAL_HTTPS: true
RAILS_ENV: test
PARALLEL_TEST_PROCESSORS: 4
ALLOW_NOPAM: true
CONTINUOUS_INTEGRATION: true
DISABLE_SIMPLECOV: true
steps:
- uses: actions/checkout@v1
- name: Install system dependencies
run: |
apt update
apt install apt-transport-https
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt update
apt install -y yarn ffmpeg libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
node -v
- name: Cache ruby dependencies
uses: actions/cache@v1
with:
path: vendor/bundle
key: v1-ruby-dependencies-${{ hashFiles('.ruby-version') }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
v1-ruby-dependencies-${{ hashFiles('.ruby-version') }}-${{ hashFiles('Gemfile.lock') }}
v1-ruby-dependencies-${{ hashFiles('.ruby-version') }}-
v1-ruby-dependencies-
- name: Cache node dependencies
uses: actions/cache@v1
with:
path: node_modules
key: v1-node-dependencies-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
v1-node-dependencies-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }}
v1-node-dependencies-${{ hashFiles('.nvmrc') }}-
v1-node-dependencies-
- name: bundle install
run: bundle install --clean --jobs 4 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without production && bundle clean
- name: yarn install
run: yarn install --frozen-lockfile
- name: Run rubocop
run: bundle exec rubocop --fail-level W --display-only-fail-level-offenses --parallel
- name: Run eslint
run: yarn test:lint
- name: Run jest
run: yarn test:jest
- name: Run brakeman
run: bundle exec brakeman --exit-on-error
- name: Run rails assets:precompile
run: ./bin/rails assets:precompile
- name: Run rails error_page:generate
run: ./bin/rails error_page:generate
- name: Create database
run: ./bin/rails parallel:create
- name: Run migrations
run: ./bin/rails parallel:migrate
# When the test is run on github actions,
# paperclip uploads a file with 0 bytes and the test fails.
# To avoid this, change TMPDIR to a directory on the same partition.
- name: Create tmp dir
run: mkdir -p tmp_for_ci && echo "TMPDIR=$(pwd)/tmp_for_ci" >> $GITHUB_ENV
- name: Run rspec
run: bundle exec parallel_test ./spec/ --group-by filesize --type rspec
- name: Slack Notification
uses: homoluctus/slatify@master
if: failure()
with:
type: ${{ job.status }}
job_name: '*github actions*'
url: ${{ secrets.SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}