added 260907 version of worker toolkit
This commit is contained in:
154
worker-toolkit-flaredown/repo/.github/workflows/backend.yml
vendored
Normal file
154
worker-toolkit-flaredown/repo/.github/workflows/backend.yml
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
name: backend
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
backend: ${{ steps.filter.outputs.backend }}
|
||||
frontend: ${{ steps.filter.outputs.frontend }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
backend:
|
||||
- 'backend/**'
|
||||
- '.github/workflows/**'
|
||||
frontend:
|
||||
- 'frontend/**'
|
||||
- '.github/workflows/**'
|
||||
|
||||
standardrb:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.backend == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
working-directory: backend
|
||||
bundler-cache: true
|
||||
|
||||
- name: Build & Run
|
||||
run: |
|
||||
bundle exec standardrb
|
||||
|
||||
erb-lint:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.backend == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
- name: ERB lint
|
||||
run: |
|
||||
gem install erb_lint
|
||||
erblint --lint-all --autocorrect
|
||||
|
||||
rspec:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.backend == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
env:
|
||||
MONGODB_HOST: localhost
|
||||
MONGODB_PORT: 27017
|
||||
POSTGRES_HOST: localhost
|
||||
DATABASE_HOST: localhost
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
POSTGRES_PORT: 5432
|
||||
INTERCOM_SECRET: secret
|
||||
BASE_URL: test.com
|
||||
|
||||
services:
|
||||
redis:
|
||||
image: redis:6.2.3-alpine
|
||||
ports: ["6379:6379"]
|
||||
options: --entrypoint redis-server
|
||||
|
||||
db:
|
||||
image: postgres:12.8-alpine
|
||||
env:
|
||||
POSTGRES_PASSWORD: password
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install PostgreSQL client
|
||||
run: |
|
||||
sudo apt-get -yqq install libpq-dev
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
working-directory: backend
|
||||
bundler-cache: true
|
||||
|
||||
- name: Start MongoDB
|
||||
uses: supercharge/mongodb-github-action@1.10.0
|
||||
with:
|
||||
mongodb-version: 4.4.9
|
||||
|
||||
- name: Load database schema
|
||||
run: |
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
|
||||
- name: Run rspec
|
||||
run: |
|
||||
bundle exec rspec
|
||||
|
||||
brakeman:
|
||||
name: Security Analysis
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
working-directory: backend
|
||||
bundler-cache: true
|
||||
- name: Brakeman
|
||||
uses: reviewdog/action-brakeman@v2
|
||||
with:
|
||||
brakeman_version: gemfile
|
||||
reporter: github-pr-review
|
||||
Reference in New Issue
Block a user