Skip to content

Commit

Permalink
update publishing instructions and add GitHub testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tate Thurston committed Jul 1, 2024
1 parent 1e966e7 commit 5f8f140
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 78 deletions.
6 changes: 0 additions & 6 deletions .github/dependabot.yml

This file was deleted.

61 changes: 18 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,28 @@
name: CI
name: Test

on: [push, pull_request]
on:
push:
branches:
# - master
pull_request:

jobs:
tests:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: [2.4, 2.7, '3.0', 3.1, 3.2, truffleruby-head]

ruby: [2.7, 3.0, 3.1, 3.2, 3.3]
name: Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v3

- name: Sets up the Ruby version
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Sets up the environment
run: |
sudo apt-get install libsqlite3-dev
- name: Install legacy bundler for Ruby 2.4
if: ${{ matrix.ruby == 2.4 }}
run: |
gem install -q bundler -v 2.3.26
- name: Install bundler 2.4+ for modern Rubies
if: ${{ matrix.ruby != 2.4 }}
run: |
gem install -q bundler
- name: Run bundle install
run: |
bundle install
- uses: actions/checkout@v2

- name: Runs code QA and tests
run: bundle exec rake
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Publish to Rubygems
continue-on-error: true
if: ${{ github.ref == 'refs/heads/master' }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
- run: |
bundle exec rake spec
env:
RAILS_ENV: test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ Gemfile.lock

# Gem builds
/*.gem

pkg
35 changes: 16 additions & 19 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ Style/WordArray:

Style/SymbolProc:
Exclude:
- 'spec/fixtures/*.rb'
- "spec/fixtures/*.rb"

Lint/DuplicateMethods:
Exclude:
- 'spec/fixtures/*.rb'

RSpec/FilePath:
Enabled: false
- "spec/fixtures/*.rb"

RSpec/DescribedClass:
Enabled: false
Expand All @@ -40,7 +37,7 @@ RSpec/NestedGroups:

Performance/TimesMap:
Exclude:
- 'spec/**/**.rb'
- "spec/**/**.rb"

Gemspec/RequiredRubyVersion:
Enabled: false
Expand All @@ -51,52 +48,52 @@ Style/Documentation:

Style/GuardClause:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Style/ConditionalAssignment:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Style/IfUnlessModifier:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Lint/AssignmentInCondition:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Metrics:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Metrics/BlockLength:
Enabled: false

Layout/LineLength:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Naming/PredicateName:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Naming/AccessorMethodName:
Exclude:
- 'lib/**/**.rb'
- "lib/**/**.rb"

Style/CaseLikeIf:
Exclude:
- 'lib/fast_jsonapi/object_serializer.rb'
- "lib/fast_jsonapi/object_serializer.rb"

Style/OptionalBooleanParameter:
Exclude:
- 'lib/fast_jsonapi/serialization_core.rb'
- 'lib/fast_jsonapi/relationship.rb'
- "lib/fast_jsonapi/serialization_core.rb"
- "lib/fast_jsonapi/relationship.rb"

Lint/DuplicateBranch:
Exclude:
- 'lib/fast_jsonapi/relationship.rb'
- "lib/fast_jsonapi/relationship.rb"

Style/DocumentDynamicEvalDefinition:
Exclude:
- 'lib/extensions/has_one.rb'
- "lib/extensions/has_one.rb"
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -838,20 +838,14 @@ This project is intended to be a safe, welcoming space for collaboration, and
contributors are expected to adhere to the
[Contributor Covenant](https://contributor-covenant.org) code of conduct.

### Publishing
### ART19 Gem Publishing

Releases are manual, performed locally on a developer's machine. Gems are published to Github Packages. A comprehesive outline of this process can be found here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry.
Releases are manual, performed locally on a developer's machine. Gems are published to Github Packages. A comprehensive outline of this process can be found here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry.

1. Increment the `ART19_REVISION` in [lib/jsonapi/serializer/version.rb#L5](https://github.com/art19/jsonapi-serializer/blob/master/lib/jsonapi/serializer/version.rb#L5)

2. Build the gem:
2. Publish the gem:

```
gem build jsonapi-serializer.gemspec
```

3. Publish your gem, replacing $VERSION with the gem version. You'll see the generated file after running `gem build` above, eg: 'jsonapi-serializer-2.2.0.1.gem'.

```
gem push --key github --host https://rubygems.pkg.github.com/art19 jsonapi-serializer-$VERSION.gem
bundle exec rake publish
```
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

desc 'Build the package and publish it to rubygems.pkg.github.com'
task publish: :build do
# Requires local setup of personal access token, see:
# 1. https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry#authenticating-with-a-personal-access-token
system("gem push --key github --host https://rubygems.pkg.github.com/art19 " \
"pkg/jsonapi-serializer-#{JSONAPI::Serializer::VERSION}.gem")
end

desc('Codestyle check and linter')
RuboCop::RakeTask.new('rubocop') do |task|
task.fail_on_error = true
Expand Down
1 change: 1 addition & 0 deletions lib/fast_jsonapi/object_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'active_support/concern'
require 'active_support/inflector'
require 'active_support/core_ext/numeric/time'
require "active_support/core_ext/object"
require 'fast_jsonapi/helpers'
require 'fast_jsonapi/attribute'
require 'fast_jsonapi/relationship'
Expand Down

0 comments on commit 5f8f140

Please sign in to comment.