Skip to content

Commit

Permalink
Avoid duplicate build folder in @primer/octicons (#1010)
Browse files Browse the repository at this point in the history
* Avoid duplicate build folder in @primer/octicons

* Update year to 2024 in LICENSE files

* Upgrade to newer artifact upload/download actions

* Use newer ruby for linting

* Upgrade rubocop version

* Upgrade rubocop in more places

* Disable checksum verification (since we're building the gem ourselves)

* Fix bad class variable access pattern

---------

Co-authored-by: Federico Brigante <me@fregante.com>
  • Loading branch information
camertron and fregante authored Mar 12, 2024
1 parent 6bc78de commit 062778c
Show file tree
Hide file tree
Showing 38 changed files with 103 additions and 47 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Building
run: yarn build
- run: cp -r icons lib/build/svg
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: octicons-build
path: ./lib/build
Expand All @@ -31,7 +31,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: octicons-build
path: ./lib/build
Expand All @@ -53,7 +53,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: octicons-build
path: ./lib/build
Expand All @@ -77,7 +77,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: octicons-build
path: ./lib/build
Expand All @@ -101,8 +101,8 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- uses: actions/download-artifact@v3
ruby-version: 3.3
- uses: actions/download-artifact@v4
with:
name: octicons-build
path: ./lib/octicons_gem/lib/build
Expand All @@ -113,7 +113,7 @@ jobs:
run: bundle exec rake test
- name: Build
run: bundle exec rake build
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
with:
name: octicons-gem
path: ./lib/octicons_gem/pkg
Expand All @@ -130,12 +130,13 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- uses: actions/download-artifact@v3
ruby-version: 3.3
- uses: actions/download-artifact@v4
with:
name: octicons-gem
path: ./lib/octicons_helper/vendor/cache
- run: bundle install
- name: Run bundle install
run: bundle config set --local disable_checksum_validation true && bundle install
- name: Linting
run: bundle exec rake lint
- name: Testing
Expand All @@ -153,12 +154,13 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- uses: actions/download-artifact@v3
ruby-version: 3.3
- uses: actions/download-artifact@v4
with:
name: octicons-gem
path: ./lib/octicons_jekyll/vendor/cache
- run: bundle install
- name: Run bundle install
run: bundle config set --local disable_checksum_validation true && bundle install
- name: Linting
run: bundle exec rake lint
- name: Testing
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- run: npm install
- run: npm run build
- run: cp -r icons lib/build/svg
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
with:
name: octicons
path: ./lib/build
Expand All @@ -23,7 +23,7 @@ jobs:
needs: setup
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
- uses: actions/download-artifact@v4
with:
name: octicons
path: ./lib/build
Expand All @@ -33,7 +33,7 @@ jobs:
with:
args: octicons_gem
- run: ls ./lib/octicons_gem/pkg
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
with:
name: octicons_gem
path: ./lib/octicons_gem/pkg
Expand All @@ -42,11 +42,11 @@ jobs:
needs: gem
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
- uses: actions/download-artifact@v4
with:
name: octicons
path: ./lib/build
- uses: actions/download-artifact@master
- uses: actions/download-artifact@v4
with:
name: octicons_gem
path: ./lib/octicons_helper/vendor/cache
Expand All @@ -60,11 +60,11 @@ jobs:
needs: gem
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
- uses: actions/download-artifact@v4
with:
name: octicons
path: ./lib/build
- uses: actions/download-artifact@master
- uses: actions/download-artifact@v4
with:
name: octicons_gem
path: ./lib/octicons_jekyll/vendor/cache
Expand All @@ -78,7 +78,7 @@ jobs:
needs: setup
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
- uses: actions/download-artifact@v4
with:
name: octicons
path: ./lib/build
Expand All @@ -92,7 +92,7 @@ jobs:
needs: setup
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
- uses: actions/download-artifact@v4
with:
name: octicons
path: ./lib/build
Expand Down
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ inherit_gem:
rubocop-github:
- config/default.yml
- config/rails.yml

AllCops:
NewCops: enable
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# frozen_string_literal: true

source "https://rubygems.org"

group :development, :test do
gem "minitest"
gem "rake"
gem "rubocop", "0.59"
gem "rubocop-github", "0.12.0"
gem "rubocop-github", "0.20.0"
end
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 GitHub Inc.
Copyright (c) 2024 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions lib/octicons_gem/Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec

group :development, :test do
gem "minitest"
gem "rake"
gem "rubocop", "0.59"
gem "rubocop-github", "0.12.0"
gem "rubocop-github", "0.20.0"
end
2 changes: 1 addition & 1 deletion lib/octicons_gem/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 GitHub Inc.
Copyright (c) 2024 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_gem/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rake/testtask"
require "rubocop/rake_task"
require "bundler/gem_tasks"
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_gem/lib/octicons.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "octicons/version"
require "octicons/octicon"
require "json"
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_gem/lib/octicons/octicon.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Octicons
class Octicon
DEFAULT_HEIGHT = 16
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_gem/lib/octicons/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Octicons
VERSION = "19.8.0".freeze
end
2 changes: 2 additions & 0 deletions lib/octicons_gem/octicons.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.expand_path("../lib/octicons/version", __FILE__)

Gem::Specification.new do |s|
Expand Down
4 changes: 3 additions & 1 deletion lib/octicons_gem/test/helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

require "minitest/autorun"
require "octicons"

def octicon(symbol, options = {})
::Octicons::Octicon.new(symbol, options)
Octicons::Octicon.new(symbol, options)
end
4 changes: 3 additions & 1 deletion lib/octicons_gem/test/octicon_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require_relative "./helper"
# frozen_string_literal: true

require_relative "helper"

describe Octicons::Octicon do
it "fails when the octicon doesn't exist" do
Expand Down
4 changes: 3 additions & 1 deletion lib/octicons_gem/test/octicons_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require_relative "./helper"
# frozen_string_literal: true

require_relative "helper"

describe Octicons do
it "loads all icons on initialization" do
Expand Down
5 changes: 3 additions & 2 deletions lib/octicons_helper/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec
Expand All @@ -8,6 +10,5 @@ gem "rails"
group :development, :test do
gem "minitest"
gem "rake"
gem "rubocop", "0.59"
gem "rubocop-github", "0.12.0"
gem "rubocop-github", "0.20.0"
end
2 changes: 1 addition & 1 deletion lib/octicons_helper/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 GitHub Inc.
Copyright (c) 2024 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_helper/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rake/testtask"
require "rubocop/rake_task"
require "bundler/gem_tasks"
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_helper/lib/octicons_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "octicons_helper/version"
require "octicons_helper/helper"
require "octicons_helper/railtie" if defined?(Rails)
2 changes: 2 additions & 0 deletions lib/octicons_helper/lib/octicons_helper/helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "octicons"
require "action_view"

Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_helper/lib/octicons_helper/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rails"

module OcticonsHelper
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_helper/lib/octicons_helper/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OcticonsHelper
VERSION = "19.8.0".freeze
end
2 changes: 2 additions & 0 deletions lib/octicons_helper/octicons_helper.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.expand_path("../lib/octicons_helper/version", __FILE__)

Gem::Specification.new do |s|
Expand Down
2 changes: 2 additions & 0 deletions lib/octicons_helper/test/helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "minitest/autorun"
require "octicons_helper"

Expand Down
10 changes: 6 additions & 4 deletions lib/octicons_helper/test/octicons_helper_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require_relative "./helper"
# frozen_string_literal: true

require_relative "helper"

describe OcticonsHelper do
describe "rendering" do
Expand All @@ -23,10 +25,10 @@

mock = Minitest::Mock.new
def mock.path
@@call_count ||= 0
@@call_count += 1
@call_count ||= 0
@call_count += 1

raise "Octicon library called twice" if @@call_count > 1
raise "Octicon library called twice" if @call_count > 1

"foo"
end
Expand Down
3 changes: 3 additions & 0 deletions lib/octicons_jekyll/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ inherit_gem:

Naming/FileName:
Enabled: false

AllCops:
NewCops: enable
5 changes: 3 additions & 2 deletions lib/octicons_jekyll/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec
Expand All @@ -7,6 +9,5 @@ gem "octicons", "19.8.0"
group :development, :test do
gem "minitest"
gem "rake"
gem "rubocop", "0.59"
gem "rubocop-github", "0.12.0"
gem "rubocop-github", "0.20.0"
end
2 changes: 1 addition & 1 deletion lib/octicons_jekyll/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 GitHub Inc.
Copyright (c) 2024 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion lib/octicons_jekyll/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rake/testtask"
require "rubocop/rake_task"
require "bundler/gem_tasks"
Expand All @@ -6,7 +8,7 @@ RuboCop::RakeTask.new(:lint) do |t|
t.options = ["--display-cop-names"]
end

task :version, [:v] do |t, args|
task :version, [:v] => :environment do |t, args|
out = "# Prevent bundler errors\n"\
"module Liquid; class Tag; end; end\n\n"\
"module Jekyll\n"\
Expand Down
Loading

0 comments on commit 062778c

Please sign in to comment.