Skip to content

Commit

Permalink
Update project files (#71)
Browse files Browse the repository at this point in the history
* Streamline EditorConfig

* Ignore history files

* Remove Bundler ecosystem from Dependabot

* Refactor CI workflow

* Add publish workflow

* Update .rspec

* Update RuboCop configuration
  • Loading branch information
jgarber623 authored Dec 9, 2023
1 parent 0b86c34 commit 85a5dd4
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 53 deletions.
5 changes: 0 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
Expand All @@ -8,7 +7,3 @@ insert_final_newline = true
indent_size = 2
indent_style = space
trim_trailing_whitespace = true

[*.md]
indent_size = 4
indent_style = tab
6 changes: 0 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
version: 2

updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "weekly"
assignees:
- "jgarber623"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
33 changes: 11 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
name: CI

on: [push, pull_request]
on:
pull_request:
push:
branches: [main]
workflow_call:
workflow_dispatch:

jobs:
analyze:
name: Analyze
permissions:
contents: read
security-events: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: github/codeql-action/init@v2
with:
languages: ruby
- uses: github/codeql-action/analyze@v2
lint:
name: Lint
permissions:
contents: read
security-events: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec rubocop
test:
name: Test
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
# See: https://github.com/actions/runner/issues/849
ruby: ["3.0", 3.1, 3.2]
os: [macos-latest, ubuntu-latest]
ruby: [3.0", "3.1", "3.2", "3.3"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish

on:
release:
types: [published]

jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
publish-to-rubygems:
name: Publish to RubyGems
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_TOKEN }}\n" > $HOME/.gem/credentials
- run: bundle exec rake release
publish-to-github-packages:
name: Publish to GitHub Packages
permissions:
contents: read
packages: write
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: Bearer ${{ secrets.GITHUB_TOKEN }}\n" > $HOME/.gem/credentials
- run: bundle exec rake release
env:
BUNDLE_GEM__PUSH_KEY: github
RUBYGEMS_HOST: "https://rubygems.pkg.github.com/${{ github.repository_owner }}"
21 changes: 3 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,9 @@
# Used by dotenv library to load environment variables.
# .env

# Ignore Byebug command history file.
.byebug_history

# Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

# Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/
# Ignore history files.
.irb_history
.rdbg_history

# Documentation cache and generated files:
/.yardoc/
Expand Down
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--order random
--require spec_helper
6 changes: 5 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
inherit_from:
- https://raw.githubusercontent.com/jgarber623/rubocop-configs/main/.rubocop.gem.yml
- https://github.com/jgarber623/rubocop-configs/raw/main/.rubocop.yml
- https://github.com/jgarber623/rubocop-configs/raw/main/.rubocop-rspec.yml

require:
- rubocop-packaging

# Checks that the keys, separators, and values of a multi-line hash literal are
# aligned according to configuration.
Expand Down

0 comments on commit 85a5dd4

Please sign in to comment.