From 72c99c677067a9359a05e320b06a80e4e2d12145 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 19:04:01 +0500 Subject: [PATCH 01/10] add commands for render --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 8b64a56..f7075a4 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,12 @@ +render-build: + bundle install + bundle exec rails assets:precompile + bundle exec rails assets:clean + bundle exec rails db:migrate + +render-start: + bin/rails server + start: rm -rf tmp/pids/server.pid || true bin/rails s From 184efc7c16aa00d03cbdea73356373fc37d559e4 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 19:16:12 +0500 Subject: [PATCH 02/10] update ruby version --- Gemfile | 2 +- Gemfile.lock | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 04641ee..ccf5189 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '~> 3.2.2' +ruby '~> 3.3.4' gem 'bootsnap', require: false gem 'cssbundling-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 784f3d0..f5c37d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -135,6 +135,7 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.2) + mini_portile2 (2.8.8) minitest (5.19.0) minitest-power_assert (0.3.1) minitest @@ -150,7 +151,8 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.3-x86_64-linux) + nokogiri (1.15.3) + mini_portile2 (~> 2.8.2) racc (~> 1.4) parallel (1.23.0) parser (3.2.2.3) @@ -279,7 +281,8 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.6.3-x86_64-linux) + sqlite3 (1.6.3) + mini_portile2 (~> 2.8.0) stimulus-rails (1.2.1) railties (>= 6.0.0) syntax_tree (6.1.1) @@ -350,7 +353,7 @@ DEPENDENCIES webdrivers RUBY VERSION - ruby 3.2.1p31 + ruby 3.3.4p94 BUNDLED WITH 2.4.6 From 3591fa1b5f13a876b2bc5f49ed2c5b837405c700 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 21:15:24 +0500 Subject: [PATCH 03/10] fix --- config/credentials.yml.enc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 config/credentials.yml.enc diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc deleted file mode 100644 index cef17dd..0000000 --- a/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -5HTkGKHNRrL3DklAXMTX0o1zZAsr1t0HqKyHGTiiwgDnkriGO5gBEzJ7PUP8HV2fMsMj1gbavKxmPqYkxE4Batx1Ai712aieSPcO4dcI5YCS0EqnV1IhPXMEnAzEEgQDkK4O6uwJAzIsPWeKvgcOy6KInG4ndlEsc8XQ1UeM7c8h1wZcSTPyMaSEWD132aqutYNnGeiwvgtCcLU4IZDwr65ivNHFE4MT1lowKvdXnXOrdGIneouByeoQOT75nHdOvNQ4qX2EBOSzlrTxHCEOTJdzO/p+pkPW9ZzprkpWjAE/YImaguJ+Yb6pKWTRqRzGqLHBCD2WZrvKP/uUEHRPpEXXRMvsQ1QdVm/ZHmkfPJi92m56S13NQzRNkiSFX7oTCASOGsqgXxPxOLd1PWhPPMktVhR0zadDvmE0--mQf8dTP1choODJ7s--clkFheRvnbCGm+D1hKZNPQ== \ No newline at end of file From 648ee8986ad6d8679931aaeb5c55aea9cc1900cd Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 21:59:41 +0500 Subject: [PATCH 04/10] fix --- config/database.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.yml b/config/database.yml index d7bc7cf..993b30b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -22,4 +22,4 @@ test: production: <<: *default - url: db/production.sqlite3 + url: <%= ENV['DATABASE_URL'] %> From 8b3c1d5643774eda71834cb8aa89ae5f76895e05 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 22:55:13 +0500 Subject: [PATCH 05/10] add render github action --- .github/workflows/render.yml | 42 ++++++++++++++++++++++++++++++++++++ .ruby-version | 1 - Makefile | 6 ++++-- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/render.yml delete mode 100644 .ruby-version diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml new file mode 100644 index 0000000..c00172d --- /dev/null +++ b/.github/workflows/render.yml @@ -0,0 +1,42 @@ +--- +name: Render + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - run: | + make setup + make test + + deploy: + needs: build + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + + steps: + - uses: actions/checkout@v4 + + - name: Deploy + run: | + "curl ${{ secrets.RENDER_DEPLOY_HOOK_URL }}" diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 9e79f6c..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-3.2.2 diff --git a/Makefile b/Makefile index f7075a4..49a5e7c 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,10 @@ render-start: start: rm -rf tmp/pids/server.pid || true bin/rails s -setup: install db-prepare + +setup: install + bin/rails assets:precompile + make db-prepare install: bin/setup @@ -38,5 +41,4 @@ compose-production-run-app: compose-production-console: docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml exec app bin/rails console - .PHONY: test From 9d0e9c3c00896395ba611c7862d49ac08727330b Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 23:03:14 +0500 Subject: [PATCH 06/10] test --- .github/workflows/render.yml | 2 +- test/controllers/posts_controller_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml index c00172d..5754a21 100644 --- a/.github/workflows/render.yml +++ b/.github/workflows/render.yml @@ -7,7 +7,7 @@ on: - main push: branches: - - main + - render-config jobs: build: diff --git a/test/controllers/posts_controller_test.rb b/test/controllers/posts_controller_test.rb index 6dbe676..d3c1126 100644 --- a/test/controllers/posts_controller_test.rb +++ b/test/controllers/posts_controller_test.rb @@ -20,4 +20,8 @@ class PostsControllerTest < ActionDispatch::IntegrationTest assert { post } end + + test 'should fail' do + assert { false } + end end From 6b4e7ae81fcf7c2ef582aa63e335379b53fc11aa Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 23:08:26 +0500 Subject: [PATCH 07/10] try fix --- .github/workflows/main.yml | 3 ++- .github/workflows/render.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 052fe06..39e206b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,7 @@ jobs: cache: 'npm' - uses: ruby/setup-ruby@v1 with: + ruby-version: '3.3' bundler-cache: true - run: | @@ -52,4 +53,4 @@ jobs: push: true cache-from: ghcr.io/${{ github.repository }}:latest cache-to: type=inline - tags: ghcr.io/${{ github.repository }}:latest \ No newline at end of file + tags: ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml index 5754a21..eeaee72 100644 --- a/.github/workflows/render.yml +++ b/.github/workflows/render.yml @@ -23,6 +23,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: + ruby-version: '3.3' bundler-cache: true - run: | From fc43f4eb0aa65f3b3b39368c108efcaf5d8efac6 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 23:11:39 +0500 Subject: [PATCH 08/10] remove test fail --- test/controllers/posts_controller_test.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/controllers/posts_controller_test.rb b/test/controllers/posts_controller_test.rb index d3c1126..6dbe676 100644 --- a/test/controllers/posts_controller_test.rb +++ b/test/controllers/posts_controller_test.rb @@ -20,8 +20,4 @@ class PostsControllerTest < ActionDispatch::IntegrationTest assert { post } end - - test 'should fail' do - assert { false } - end end From f9e68dd961800f64162453409fafa58c4ebddc69 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 23:15:01 +0500 Subject: [PATCH 09/10] fix config --- .github/workflows/render.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml index eeaee72..00ce3bd 100644 --- a/.github/workflows/render.yml +++ b/.github/workflows/render.yml @@ -7,7 +7,7 @@ on: - main push: branches: - - render-config + - render-test jobs: build: @@ -40,4 +40,4 @@ jobs: - name: Deploy run: | - "curl ${{ secrets.RENDER_DEPLOY_HOOK_URL }}" + curl ${{ secrets.RENDER_DEPLOY_HOOK_URL }} From 7e1a290a83cdc8531e721cca2cb926cf8b43c4f0 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 11 Feb 2025 23:52:17 +0500 Subject: [PATCH 10/10] update --- .github/workflows/docker.yml | 56 ++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 25 ++++------------ .github/workflows/render.yml | 43 --------------------------- 3 files changed, 62 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/docker.yml delete mode 100644 .github/workflows/render.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..0a7117d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,56 @@ +--- +name: Docker + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + + - run: | + make setup + bin/rails assets:precompile + make test + + docker: + needs: build + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + cache-from: ghcr.io/${{ github.repository }}:latest + cache-to: type=inline + tags: ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 39e206b..54634e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ --- -name: Main +name: Render on: pull_request: @@ -15,10 +15,12 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' + - uses: ruby/setup-ruby@v1 with: ruby-version: '3.3' @@ -26,7 +28,6 @@ jobs: - run: | make setup - bin/rails assets:precompile make test deploy: @@ -37,20 +38,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - push: true - cache-from: ghcr.io/${{ github.repository }}:latest - cache-to: type=inline - tags: ghcr.io/${{ github.repository }}:latest + - name: Deploy + run: | + curl ${{ secrets.RENDER_DEPLOY_HOOK_URL }} diff --git a/.github/workflows/render.yml b/.github/workflows/render.yml deleted file mode 100644 index 00ce3bd..0000000 --- a/.github/workflows/render.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -name: Render - -on: - pull_request: - branches: - - main - push: - branches: - - render-test - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'npm' - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.3' - bundler-cache: true - - - run: | - make setup - make test - - deploy: - needs: build - runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' }} - - steps: - - uses: actions/checkout@v4 - - - name: Deploy - run: | - curl ${{ secrets.RENDER_DEPLOY_HOOK_URL }}