ci #588
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 | |
jobs: | |
test: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./personal | |
services: | |
postgres: | |
image: postgis/postgis:14-3.2 | |
env: | |
POSTGRES_DB: personal_test | |
POSTGRES_USER: postgres | |
POSTGRES_HOST_AUTH_METHOD: trust | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
redis: | |
image: redis:7.0.4 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install apt packages | |
run: | | |
sudo apt-get update - | |
sudo apt-get -yqq install zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn | |
- name: Setup ruby, bundler, gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
working-directory: ./personal | |
- name: Cache node modules | |
uses: actions/cache@v1 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install npm packages | |
run: yarn install --frozen-lockfile | |
- name: Install Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Run tests | |
env: # Or as an environment variable | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
RAILS_ENV: test | |
COVERAGE: 1 | |
run: | | |
bundle exec rails db:reset | |
bundle exec rails assets:precompile | |
bundle exec rails test |