Skip to content

refactor: update github action prd version #1167

refactor: update github action prd version

refactor: update github action prd version #1167

Workflow file for this run

name: Rails Tests
on:
push:
branches:
- master
- develop
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: 5432
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
RAILS_ENV: test
IMAGEMAGICK_SRC: 7.1.0-50.tar.gz
SLACK_API_TOKEN: xoxb-dummy
SLACK_MESSAGE_CHANNEL: '#test'
services:
db:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379/tcp
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: apt-get
run: |
sudo apt-get update -y
sudo apt-get -yqq install libpq-dev postgresql-client libfuse2
- name: check imagemagick
run: |
export PATH=${GITHUB_WORKSPACE}/vendor/imagemagick7/bin:${PATH}
which convert
convert -version
- name: Set up Ruby 3.0.6
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.6
bundler-cache: true
- name: setup Node
uses: actions/setup-node@v3
with:
node-version: 16.13.0
cache: 'yarn'
- name: install yarn
run: |
npm i -g yarn@1.22.15
yarn install --frozen-lockfile
- name: create assets precompile cache key
run: |
# use newest commit hash of precompile target files
git rev-parse $(git log --oneline -n 1 app/packs lib/assets Gemfile.lock yarn.lock | awk '{print $1}') > ASSETS_VERSION
- name: asset cache
uses: actions/cache@v3
with:
path: |
public/packs
public/assets
tmp/cache/assets
public/packs-test
key: asset-precompile-cache-${{ hashFiles('ASSETS_VERSION') }}
restore-keys: |
asset-precompile-cache-${{ hashFiles('ASSETS_VERSION') }}
asset-precompile-cache-
- name: Migrate DB
run: |
bundle exec rails db:create db:migrate
- name: Precompile assets
run: bundle exec rails assets:precompile
- name: Test with RSpec
run: |
bundle exec rails spec