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

Commit 18e785a

Browse files
committed
try to fix healtcheck job
1 parent c811a51 commit 18e785a

File tree

4 files changed

+44
-30
lines changed

4 files changed

+44
-30
lines changed

.github/workflows/ci.yml

+29-20
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,33 @@ jobs:
6262
- name: Clear
6363
run: make ci-clear
6464

65-
# healthcheck:
66-
# runs-on: ubuntu-latest
67-
# needs: build
68-
# steps:
69-
# - name: Checkout code
70-
# uses: actions/checkout@v4
71-
72-
# - name: Prepare
73-
# run: cp ./.env.example ./.env
74-
75-
# - name: Download image
76-
# uses: actions/download-artifact@v4
77-
# with:
78-
# name: bmstu_2024-app
79-
# path: /tmp
80-
81-
# - name: Load container
82-
# run: docker load --input /tmp/bmstu_2024-app.tar
65+
healthcheck:
66+
runs-on: ubuntu-latest
67+
needs: build
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Prepare
73+
run: cp ./.env.example ./.env
74+
75+
- name: Download image
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: bmstu_2024-app
79+
path: /tmp
80+
81+
- name: Load container
82+
run: docker load --input /tmp/bmstu_2024-app.tar
8383

84-
# - name: Healthcheck
85-
# run: make ci-up-healthy
84+
- name: Make user
85+
run: |
86+
adduser -D rails --shell /bin/ash
87+
chmod 777 .
88+
89+
- name: Healthcheck
90+
run: make ci-up-healthy
91+
92+
- name: Clear
93+
run: make ci-clear
94+

Dockerfile.dev

+3-5
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ RUN bundle exec bootsnap precompile app/ lib/
3939
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
4040
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
4141

42-
RUN adduser -D rails --shell /bin/bash
42+
RUN adduser -D rails --shell /bin/ash
4343
RUN mkdir -p /usr/local/bundle/ruby/3.2.0/cache
44-
RUN chown -R rails:rails \
45-
db log storage tmp \
46-
/usr/local/bundle/ruby/3.2.0/cache
47-
RUN chmod -R 777 /usr/local/bundle/ruby/3.2.0/cache
44+
RUN chown -R rails:rails storage /usr/local/bundle/ruby/3.2.0/cache
45+
RUN chmod -R 755 /usr/local/bundle/ruby/3.2.0/cache
4846

4947
USER rails:rails
5048

Makefile

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ GID := $(shell id -g)
66
include .env
77
export
88

9+
RAILS_ENV ?= development
10+
911
setup: build db-prepare
1012

1113
build:
@@ -52,7 +54,7 @@ db-psql:
5254
db-prepare: db-drop db-create db-migrate db-seed
5355

5456
db-create:
55-
docker compose run --rm app bin/rails db:create RAILS_ENV=development
57+
docker compose run --rm app bin/rails db:create RAILS_ENV=${RAILS_ENV}
5658

5759
db-migrate:
5860
docker compose run --rm app bin/rails db:migrate
@@ -70,11 +72,11 @@ db-drop:
7072
docker compose run --rm app bin/rails db:drop
7173

7274
ci-build:
73-
bundle lock --update
74-
npm install --package-lock-only
75-
docker compose build -q
75+
docker compose build
7676

77-
ci-up-healthy: db-prepare
77+
ci-up-healthy:
78+
export CI=
79+
RAILS_ENV=test make db-prepare
7880
docker compose up -d --wait --wait-timeout 60
7981

8082
ci-rubocop: rubocop

config/environments/test.rb

+5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# frozen_string_literal: true
22

33
require 'active_support/core_ext/integer/time'
4+
require 'logger'
45

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

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

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

0 commit comments

Comments
 (0)