Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action to run tests #4

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 0 additions & 100 deletions .circleci/config.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/gem-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Ruby Gem

on:
push:
branches: [ "master" ]

jobs:
build:
name: Build + Publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run Tests

on:
pull_request:
branches: "**"

permissions:
contents: read
checks: write
pull-requests: write

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2']

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rspec --profile 10 --format RspecJunitFormatter --out test_results/rspec.xml --format progress
- name: Upload result
uses: actions/upload-artifact@v3
if: always()
with:
name: rspec_${{ matrix.ruby-version }}.xml
path: test_results/rspec.xml
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: Rspec Tests - ${{ matrix.ruby-version }}
path: test_results/rspec.xml
reporter: java-junit
4 changes: 1 addition & 3 deletions safe_values.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ Gem::Specification.new do |spec|
spec.homepage = 'http://github.com/iknow/safe_values'
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.files = Dir["lib/**/*", "LICENSE.txt", "README.md"]
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
Expand Down
Loading