Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
try to fix healtcheck job
Browse files Browse the repository at this point in the history
  • Loading branch information
vzalygin committed Jul 18, 2024
1 parent c811a51 commit 18e785a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 30 deletions.
49 changes: 29 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,33 @@ jobs:
- name: Clear
run: make ci-clear

# healthcheck:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Prepare
# run: cp ./.env.example ./.env

# - name: Download image
# uses: actions/download-artifact@v4
# with:
# name: bmstu_2024-app
# path: /tmp

# - name: Load container
# run: docker load --input /tmp/bmstu_2024-app.tar
healthcheck:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare
run: cp ./.env.example ./.env

- name: Download image
uses: actions/download-artifact@v4
with:
name: bmstu_2024-app
path: /tmp

- name: Load container
run: docker load --input /tmp/bmstu_2024-app.tar

# - name: Healthcheck
# run: make ci-up-healthy
- name: Make user
run: |
adduser -D rails --shell /bin/ash
chmod 777 .
- name: Healthcheck
run: make ci-up-healthy

- name: Clear
run: make ci-clear

8 changes: 3 additions & 5 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

RUN adduser -D rails --shell /bin/bash
RUN adduser -D rails --shell /bin/ash
RUN mkdir -p /usr/local/bundle/ruby/3.2.0/cache
RUN chown -R rails:rails \
db log storage tmp \
/usr/local/bundle/ruby/3.2.0/cache
RUN chmod -R 777 /usr/local/bundle/ruby/3.2.0/cache
RUN chown -R rails:rails storage /usr/local/bundle/ruby/3.2.0/cache
RUN chmod -R 755 /usr/local/bundle/ruby/3.2.0/cache

USER rails:rails

Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ GID := $(shell id -g)
include .env
export

RAILS_ENV ?= development

setup: build db-prepare

build:
Expand Down Expand Up @@ -52,7 +54,7 @@ db-psql:
db-prepare: db-drop db-create db-migrate db-seed

db-create:
docker compose run --rm app bin/rails db:create RAILS_ENV=development
docker compose run --rm app bin/rails db:create RAILS_ENV=${RAILS_ENV}

db-migrate:
docker compose run --rm app bin/rails db:migrate
Expand All @@ -70,11 +72,11 @@ db-drop:
docker compose run --rm app bin/rails db:drop

ci-build:
bundle lock --update
npm install --package-lock-only
docker compose build -q
docker compose build

ci-up-healthy: db-prepare
ci-up-healthy:
export CI=
RAILS_ENV=test make db-prepare
docker compose up -d --wait --wait-timeout 60

ci-rubocop: rubocop
Expand Down
5 changes: 5 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# frozen_string_literal: true

require 'active_support/core_ext/integer/time'
require 'logger'

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!

Rails.application.configure do
# if ENV['CI'].present?
# config.logger = Logger.new($stdout)
# ENV['TMPDIR'] = '/tmp'
# end
# Settings specified here will take precedence over those in config/application.rb.

# While tests run files are not watched, reloading is not necessary.
Expand Down

0 comments on commit 18e785a

Please sign in to comment.