mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
134 lines
3.2 KiB
YAML
134 lines
3.2 KiB
YAML
name: Build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches-ignore:
|
|
- 'dependabot/**'
|
|
pull_request:
|
|
|
|
env:
|
|
DISABLE_KNAPSACK: true
|
|
TIMEZONE: UTC
|
|
COVERAGE: true
|
|
RAILS_ENV: test
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
rspec:
|
|
runs-on: ubuntu-20.04
|
|
services:
|
|
postgres:
|
|
image: postgres:10
|
|
ports: ["5432:5432"]
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
env:
|
|
POSTGRES_DB: open_food_network_test
|
|
POSTGRES_USER: ofn
|
|
POSTGRES_PASSWORD: f00d
|
|
strategy:
|
|
matrix:
|
|
specs:
|
|
- "spec/controllers"
|
|
- "spec/models"
|
|
- "spec/lib"
|
|
- "spec/migrations"
|
|
- "spec/serializers"
|
|
- "spec/system/admin/[a-o0-9]*"
|
|
- "spec/system/admin/[p-z]*"
|
|
- "spec/system/consumer/[a-o0-9]*"
|
|
- "spec/system/consumer/[p-z]*"
|
|
- "engines/*/spec"
|
|
fail-fast: false
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup redis
|
|
uses: supercharge/redis-github-action@1.4.0
|
|
with:
|
|
redis-version: 6
|
|
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
|
|
- name: Install JS dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Set up database
|
|
run: |
|
|
bundle exec rake db:create
|
|
bundle exec rake db:schema:load
|
|
|
|
- name: Run tests
|
|
run: bundle exec rspec --profile -- ${{ matrix.specs }}
|
|
|
|
- name: Archive failed tests screenshots
|
|
if: failure()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: failed-tests-screenshots
|
|
path: tmp/capybara/screenshots/*.png
|
|
retention-days: 7
|
|
if-no-files-found: ignore
|
|
|
|
test-the-rest:
|
|
runs-on: ubuntu-20.04
|
|
services:
|
|
postgres:
|
|
image: postgres:10
|
|
ports: ["5432:5432"]
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
env:
|
|
POSTGRES_DB: open_food_network_test
|
|
POSTGRES_USER: ofn
|
|
POSTGRES_PASSWORD: f00d
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup redis
|
|
uses: supercharge/redis-github-action@1.4.0
|
|
with:
|
|
redis-version: 6
|
|
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
|
|
- name: Install JS dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Set up database
|
|
run: |
|
|
bundle exec rake db:create
|
|
bundle exec rake db:schema:load
|
|
|
|
- name: Run JS tests
|
|
run: bundle exec rake karma:run
|
|
|
|
- name: Run jest tests
|
|
run: yarn jest
|
|
|
|
- name: Run all other tests
|
|
run: bundle exec rake ofn:specs:run:excluding_folders["models,controllers,serializers,features,lib,migrations,system"]
|