diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..0c5574c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,56 @@ +version: 2.1 +orbs: + # To install the required node version + node: circleci/node@5.0.3 +jobs: + build: + # No. of servers/machines + parallelism: 1 + docker: + - image: cimg/ruby:3.3.5 + - image: cimg/redis:5.0.14 + - image: cimg/postgres:9.6 + environment: + POSTGRES_HOST_AUTH_METHOD: trust + + #application directory change it with your application directory name + working_directory: ~/granite + environment: + TZ: "/usr/share/zoneinfo/America/New_York" + RAILS_ENV: "test" + RACK_ENV: "test" + + steps: + - checkout + - node/install: + install-yarn: true + node-version: "22.13" + - run: node --version + - run: gem install bundler:2.2.20 + #install sqlite dependency + - run: sudo apt update && sudo apt install zlib1g-dev libsqlite3-dev + # Bundle install + - run: bundle check --path=vendor/bundle || bundle install + --path=vendor/bundle --jobs=4 --retry=3 + # Yarn install + - run: yarn install --cache-folder vendor/node_modules + # Ensure Rubocop has linted all Ruby files + - run: bundle exec rubocop + # Ensure Prettier+ESLint has been run on all JS files + - run: + npx prettier "./app/javascript/src/**/*.{js,jsx,json}" && npx eslint + "./app/javascript/src/**/*.{js,jsx,json}" + # Setup database + - run: cp config/database.yml.ci config/database.yml + - run: bundle exec rails db:create db:schema:load --trace + # Generate assets + - run: yarn build + # Unit tests + - run: + shell: /bin/bash + command: bundle exec rake db:test:prepare && bundle exec rails t -v +workflows: + version: 2 + commit: + jobs: + - build \ No newline at end of file