Skip to content

Commit

Permalink
ci: [DX-32] Add github actions for spec, release and rubocop (#11)
Browse files Browse the repository at this point in the history
* [DX-32] Add github actions for spec, release and rubocop

* [DX-32] Fix 18n references
  • Loading branch information
PetersenSQ authored Mar 9, 2023
1 parent 83487d5 commit a4abe39
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Create release pull request
on:
push:
branches:
- 'master'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
release-type: ruby
package-name: factiva-api-client
bump-minor-pre-major: true
version-file: 'lib/factiva/version.rb'
- uses: actions/checkout@v2
if: ${{ steps.release.outputs.release_created }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
if: ${{ steps.release.outputs.release_created }}
- name: Publish gem to Github repostiory packages
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
env:
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
OWNER: ${{ github.repository_owner }}
if: ${{ steps.release.outputs.release_created }}
28 changes: 28 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run gem static analysis
on:
pull_request:
types: [opened, synchronize]

jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: |
git fetch --no-tags --prune origin
- name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
cache-version: 1
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
use_bundler: true
reporter: github-pr-review
filter_mode: file
fail_on_error: true

20 changes: 20 additions & 0 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Run url_shortener-client gem specs
on:
push:
branches:
- "**" # matches every branch
- '!master' # excludes master
jobs:
run-specs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
cache-version: 1
- name: Run tests
run: |
bundle exec rspec
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ GEM

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
factiva-api-client!
Expand Down

0 comments on commit a4abe39

Please sign in to comment.