Merge pull request #442 from wearepal/kew-data-2 #677
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: "Landscapes CI" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11-alpine | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_DB: rails_test | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install required apt packages | |
run: | | |
sudo apt-get -y install libpq-dev | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Setup database | |
run: bin/rails db:setup | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'yarn' | |
- name: Install Node dependencies | |
run: | | |
yarn --frozen-lockfile | |
- name: Precompile assets | |
run: SECRET_KEY_BASE="0" bin/rails assets:precompile | |
- name: Rails tests | |
run: bin/rails test | |
# - name: System tests (Chrome) | |
# run: SYSTEM_TEST_BROWSER=headless_chrome bin/rails test:system | |
- name: System tests (Firefox) | |
run: SYSTEM_TEST_BROWSER=headless_firefox bin/rails test:system |