Skip to content

Commit

Permalink
Merge pull request #77 from AlchemyCMS/ci-fixes
Browse files Browse the repository at this point in the history
CI fixes
  • Loading branch information
tvdeyen authored May 7, 2024
2 parents 94c4a10 + 1bef19f commit e022e20
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/brakeman-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Customize the ruby version depending on your needs
- name: Set up Ruby
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Test

on:
- push
- pull_request
push:
branches:
- main
pull_request:

jobs:
RSpec:
Expand All @@ -11,23 +13,26 @@ jobs:
fail-fast: false
matrix:
alchemy_branch:
- 7.0-stable
- 7.1-stable
- main
ruby:
- "3.0"
- "3.1"
- "3.2"
- "3.3"
env:
ALCHEMY_BRANCH: ${{ matrix.alchemy_branch }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Restore apt cache
id: apt-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /home/runner/apt/cache
key: apt-sqlite-
Expand All @@ -49,9 +54,9 @@ jobs:
env:
NODE_ENV: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Restore node modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('./package.json') }}
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ pkg/
spec/dummy/log/*.log
spec/dummy/tmp/
Gemfile.lock
spec/dummy/db/*.sqlite3
spec/dummy/uploads
spec/dummy/db/development.sqlite3
spec/dummy/db/schema.rb
spec/dummy/db/migrate
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3*
spec/dummy/public
Gemfile.lock
.ruby-version
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ gemspec

# To use a debugger
# gem 'byebug', group: [:development, :test]
gem "sqlite3"
gem "sqlite3", "~> 1.4"

alchemy_branch = ENV.fetch("ALCHEMY_BRANCH", "main")
gem "alchemy_cms", github: "AlchemyCMS/alchemy_cms", branch: alchemy_branch
gem "alchemy-devise", github: "AlchemyCMS/alchemy-devise", branch: alchemy_branch
gem "alchemy-devise", github: "AlchemyCMS/alchemy-devise", branch: "main"

gem "rufo"
gem "rubocop"
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/alchemy/json_api/admin/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def caching_options
end

def set_current_preview
Alchemy::Page.current_preview = @page
if Alchemy.const_defined?(:Current)
Alchemy::Current.preview_page = @page
else
Alchemy::Page.current_preview = @page
end
end

def last_modified_for(page)
Expand Down
12 changes: 10 additions & 2 deletions app/controllers/alchemy/json_api/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,17 @@ def api_page(page)
def base_page_scope
# cancancan is not able to merge our complex AR scopes for logged in users
if can?(:edit_content, ::Alchemy::Page)
Alchemy::Language.current.pages.joins(page_version_type)
current_language.pages.joins(page_version_type)
else
Alchemy::Language.current.pages.published.joins(page_version_type)
current_language.pages.published.joins(page_version_type)
end
end

def current_language
if Alchemy.const_defined?(:Current)
Alchemy::Current.language
else
Alchemy::Language.current
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

it "stores page as preview" do
get :show, params: { path: page.urlname }
expect(Alchemy::Page.current_preview).to eq(page.id)
if Alchemy.const_defined?(:Current)
expect(Alchemy::Current.preview_page).to eq(page)
else
expect(Alchemy::Page.current_preview).to eq(page.id)
end
end
end
end

0 comments on commit e022e20

Please sign in to comment.