1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-22 22:59:39 +02:00

Reuse ci workflow (#819)

This commit is contained in:
Zach Gollwitzer 2024-05-30 15:44:16 -04:00 committed by GitHub
parent df391e0a14
commit ee162bbef7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 53 deletions

View file

@ -1,7 +1,7 @@
name: CI name: CI
on: on:
pull_request: workflow_call:
jobs: jobs:
scan_ruby: scan_ruby:
@ -59,6 +59,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432
RAILS_ENV: test
services: services:
postgres: postgres:
image: postgres image: postgres
@ -82,16 +86,19 @@ jobs:
ruby-version: .ruby-version ruby-version: .ruby-version
bundler-cache: true bundler-cache: true
- name: Run tests and smoke test seed - name: DB setup and smoke test
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
run: | run: |
bin/rails db:create bin/rails db:create
bin/rails db:schema:load bin/rails db:schema:load
bin/rails test
bin/rails db:seed bin/rails db:seed
- name: Unit and integration tests
run: bin/rails test
- name: System tests
run: DISABLE_PARALLELIZATION=true bin/rails test:system
continue-on-error: true # TODO: Eventually we'll enforce for PRs
- name: Keep screenshots from failed system tests - name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: failure() if: failure()

8
.github/workflows/pr.yml vendored Normal file
View file

@ -0,0 +1,8 @@
name: Pull Request
on:
pull_request:
jobs:
ci:
uses: ./.github/workflows/ci.yml

View file

@ -15,56 +15,12 @@ permissions:
contents: read contents: read
jobs: jobs:
ci:
test: uses: ./.github/workflows/ci.yml
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libvips postgresql-client libpq-dev
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Run tests and smoke test seed
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
run: |
bin/rails db:create
bin/rails db:schema:load
bin/rails test:all
bin/rails db:seed
- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore
build: build:
name: Build docker image name: Build docker image
needs: [ test ] needs: [ ci ]
runs-on: ubuntu-latest runs-on: ubuntu-latest