Skip to content

OCT/2023 - Implemented the design suggestions provided by the UX team #1385

OCT/2023 - Implemented the design suggestions provided by the UX team

OCT/2023 - Implemented the design suggestions provided by the UX team #1385

Workflow file for this run

name: Test
on:
push:
pull_request:
branches:
- main
jobs:
test-backend:
env:
RAILS_ENV: test
BUNDLE_GEMFILE: ${{ github.workspace }}/backend/Gemfile
DATABASE_URL: postgres://postgres:urbanleague@localhost:5432/test
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
# alpine is a small linux distro- runs faster than default rhel image
image: postgres:alpine
# Provide the password for postgres
env:
POSTGRES_PASSWORD: urbanleague
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports: ['5432:5432']
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Update bundler-audit
run: bundle exec bundle-audit update
- name: Run security checks
run: |
bundle exec bundler-audit
bundle exec brakeman -q -w2
- name: Run linters
run: bundle exec rubocop --parallel
- name: Create Test Database
run: |
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails db:schema:load
- name: Run tests
run: bundle exec rspec
test-ui:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend/front
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: install dependencies
run: yarn --immutable
- name: Run linters
run: yarn test-style
- name: Run tests
run: yarn test
build_image:
name: Build Image
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
needs: [test-backend]
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/arm64
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: urban-league-heat-pump-accelerator
IMAGE_TAG: ${{ github.sha }}
run: |
docker buildx build --platform linux/arm64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f ./backend/Dockerfile . --push