Giter VIP home page Giter VIP logo

rails_template_test_screenshot's Introduction

[![Build Status](CI_BADGE_URL goes here)](REPO_URL goes here)

Introduction

App introduction goes here ...

Project Setup

Prerequisites

  • Ruby version: 2.7.2
  • Node version: 14.15.4

Docker

./bin/envsetup.sh

Development

  • Setup the databases:

    • Postgres:
    rake db:setup
  • Run the Rails app

foreman start -f Procfile.dev

Tests

Docker-based tests on the CI server

Add the following build settings to run the tests in the Docker environment via Docker Compose (configuration in docker-compose.test.yml):

  • Configure the environment variable BRANCH_TAG to tag Docker images per branch, e.g:
# a unique `BRANCH_TAG` value to tag the Docker image
# e.g $SEMAPHORE_BRANCH_ID or using the
# or using nimblehq/[email protected] Github action
export BRANCH_TAG= # unique value for tagging Docker image

Each branch needs to have its own Docker image to avoid build settings disparities and leverage Docker image caching.

BRANCH_TAG must not contain special characters (/) to be valid. So using $BRANCH_NAME will not work e.g. chore/setup-docker. An alternative is to use a unique identifier such as PR_ID or BRANCH_ID on the CI server.

  • Pull the latest version the Docker image for the branch:
docker pull $DOCKER_IMAGE:$BRANCH_TAG || true

On each build, the CI environment does not contain yet a cached version of the image. Therefore, it is required to pull it first to leverage the cache_from settings of Docker Compose which avoids rebuilding the whole Docker image on subsequent test builds.

  • Build the Docker image:
./bin/docker-prepare && docker-compose -f docker-compose.test.yml build

Upon the first build, the whole Docker image is built from the ground up and tagged using $BRANCH_TAG.

  • Push the latest version of the Docker image for this branch:
docker push $DOCKER_IMAGE:$BRANCH_TAG
  • Setup the test database:
docker-compose -f docker-compose.test.yml run test bin/bundle exec rake db:test:prepare

Semaphore CI 2.0

To setup the semaphore CI 2.0 for the project, please follow this guideline

Github actions & Heroku Deployment

To setup Github actions for the project, please follow this guideline

Test

  • Run all tests:
# Docker way
docker-compose -f docker-compose.test.yml run test

# Non-Docker way
rspec
  • Run a specific test:
# Docker way
docker-compose -f docker-compose.test.yml run test bin/bundle exec rspec [rspec-params]

# Non-Docker way
rspec [rspec-params]

Automated Code Review Setup

  • Add a bot (i.e. team-nimblehq) to this repository or to the organization. The bot requires permission level “Write” to be able to set a PR’s status.

  • Create a Personal Access Token from bot account with public_repo scope, and set it as DANGER_GITHUB_API_TOKEN secret on the CI Environment Settings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.