Skip to content

Commit 0b3dff8

Browse files
tatthursTate Thurston
and
Tate Thurston
authored
add ci testing and update publishing instructions (#6)
* update publishing instructions and add GitHub testing * Update ci.yml --------- Co-authored-by: Tate Thurston <[email protected]>
1 parent 1e966e7 commit 0b3dff8

File tree

6 files changed

+31
-58
lines changed

6 files changed

+31
-58
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,27 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request:
49

510
jobs:
6-
tests:
11+
test:
712
runs-on: ubuntu-latest
813
strategy:
914
fail-fast: false
1015
matrix:
11-
ruby: [2.4, 2.7, '3.0', 3.1, 3.2, truffleruby-head]
12-
16+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
17+
name: Ruby ${{ matrix.ruby }}
1318
steps:
14-
- uses: actions/checkout@v3
15-
16-
- name: Sets up the Ruby version
17-
uses: ruby/setup-ruby@v1
18-
with:
19-
ruby-version: ${{ matrix.ruby }}
20-
21-
- name: Sets up the environment
22-
run: |
23-
sudo apt-get install libsqlite3-dev
24-
25-
- name: Install legacy bundler for Ruby 2.4
26-
if: ${{ matrix.ruby == 2.4 }}
27-
run: |
28-
gem install -q bundler -v 2.3.26
29-
30-
- name: Install bundler 2.4+ for modern Rubies
31-
if: ${{ matrix.ruby != 2.4 }}
32-
run: |
33-
gem install -q bundler
34-
35-
- name: Run bundle install
36-
run: |
37-
bundle install
19+
- uses: actions/checkout@v4
3820

39-
- name: Runs code QA and tests
40-
run: bundle exec rake
21+
- uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: ${{ matrix.ruby }}
24+
bundler-cache: true
4125

42-
- name: Publish to Rubygems
43-
continue-on-error: true
44-
if: ${{ github.ref == 'refs/heads/master' }}
45-
run: |
46-
mkdir -p $HOME/.gem
47-
touch $HOME/.gem/credentials
48-
chmod 0600 $HOME/.gem/credentials
49-
printf -- "---\n:rubygems_api_key: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
50-
gem build *.gemspec
51-
gem push *.gem
52-
env:
53-
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
26+
- run: |
27+
bundle exec rake spec

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ Gemfile.lock
4646

4747
# Gem builds
4848
/*.gem
49+
50+
pkg

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -838,20 +838,14 @@ This project is intended to be a safe, welcoming space for collaboration, and
838838
contributors are expected to adhere to the
839839
[Contributor Covenant](https://contributor-covenant.org) code of conduct.
840840

841-
### Publishing
841+
### ART19 Gem Publishing
842842

843-
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.
843+
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.
844844

845845
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)
846846

847-
2. Build the gem:
847+
2. Publish the gem:
848848

849849
```
850-
gem build jsonapi-serializer.gemspec
851-
```
852-
853-
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'.
854-
855-
```
856-
gem push --key github --host https://rubygems.pkg.github.com/art19 jsonapi-serializer-$VERSION.gem
850+
bundle exec rake publish
857851
```

Rakefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ require 'bundler/gem_tasks'
22
require 'rspec/core/rake_task'
33
require 'rubocop/rake_task'
44

5+
desc 'Build the package and publish it to rubygems.pkg.github.com'
6+
task publish: :build do
7+
# Requires local setup of personal access token, see:
8+
# 1. https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry#authenticating-with-a-personal-access-token
9+
system("gem push --key github --host https://rubygems.pkg.github.com/art19 " \
10+
"pkg/jsonapi-serializer-#{JSONAPI::Serializer::VERSION}.gem")
11+
end
12+
513
desc('Codestyle check and linter')
614
RuboCop::RakeTask.new('rubocop') do |task|
715
task.fail_on_error = true

lib/fast_jsonapi/object_serializer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
require 'active_support/concern'
66
require 'active_support/inflector'
77
require 'active_support/core_ext/numeric/time'
8+
require "active_support/core_ext/object"
89
require 'fast_jsonapi/helpers'
910
require 'fast_jsonapi/attribute'
1011
require 'fast_jsonapi/relationship'

0 commit comments

Comments
 (0)