Skip to content

Update attendance view service for performance improvement #3327

Update attendance view service for performance improvement

Update attendance view service for performance improvement #3327

Workflow file for this run

name: Backend CI
concurrency:
group: backend-${{ github.head_ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
pull_request:
paths-ignore:
- 'docs/**'
workflow_dispatch:
jobs:
lint_backend:
name: Backend linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
- name: Rubocop
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle exec rubocop
# TODO: Parse error was fixed in Brakeman 5.1.2 but
# the Github Action is using the docker image
# which is stuck at 5.1.1 so we need to disable
# this for now
brakeman:
name: Brakeman Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Analyze code statically using Brakeman
uses: artplan1/brakeman-action@v1.2.1
with:
flags: '--color'
test_backend:
name: Backend tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
# Install local deps if this action is being run locally
- name: Install local dependencies
if: ${{ env.ACT }}
run: |
echo $TZ
npm i -g yarn
sudo apt-get update
sudo apt-get -yqq install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 libxshmfence-dev postgresql postgresql-contrib redis-server
- name: Boot local dependencies
if: ${{ env.ACT }}
run: |
sudo service postgresql start
sudo service redis-server start
- name: Configure local dependencies
if: ${{ env.ACT }}
run: |
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=postgres
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password 'postgres';"
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
- name: Install libraries
run: sudo apt-get install libpq-dev
- name: Bundle install
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Setup Database
run: |
cp config/database.yml.github-actions config/database.yml
bundle exec rake db:create
bundle exec rake db:schema:load
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Run RSpec
run: bundle exec rspec --require rails_helper
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DEVISE_JWT_SECRET_KEY: imasecretkey