diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index db71747..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2.1 - -executors: - ruby: - parameters: - ruby-version: - type: string - default: "2.6" - gemfile: - type: string - default: "Gemfile" - docker: - - image: circleci/ruby:<< parameters.ruby-version >> - environment: - BUNDLE_JOBS: 3 - BUNDLE_RETRY: 3 - BUNDLE_PATH: vendor/bundle - RAILS_ENV: test - BUNDLE_GEMFILE: << parameters.gemfile >> - -jobs: - test: - parameters: - ruby-version: - type: string - executor: - name: ruby - ruby-version: << parameters.ruby-version >> - parallelism: 1 - steps: - - checkout - - - run: - # Remove the non-appraisal gemfile for safety: we never want to use it. - name: Prepare bundler - command: bundle -v - - - run: - name: Compute a gemfile lock - command: bundle lock && cp "${BUNDLE_GEMFILE}.lock" /tmp/gem-lock - - - restore_cache: - keys: - - safe_values-<< parameters.ruby-version >>-{{ checksum "/tmp/gem-lock" }} - - safe_values- - - - run: - name: Bundle Install - command: bundle check || bundle install - - - save_cache: - key: safe_values-<< parameters.ruby-version >>-{{ checksum "/tmp/gem-lock" }} - paths: - - vendor/bundle - - - run: - name: Run rspec - command: bundle exec rspec --profile 10 --format RspecJunitFormatter --out test_results/rspec.xml --format progress - - - store_test_results: - path: test_results - - publish: - executor: ruby - steps: - - checkout - - run: - name: Setup Rubygems - command: | - mkdir ~/.gem && - echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials && - chmod 0600 ~/.gem/credentials - - run: - name: Publish to Rubygems - command: | - gem build safe_values.gemspec - gem push safe_values-*.gem - -workflows: - version: 2.1 - build: - jobs: - - test: - name: 'ruby 2.5' - ruby-version: "2.5" - - test: - name: 'ruby 2.6' - ruby-version: "2.6" - - test: - name: 'ruby 2.7' - ruby-version: "2.7" - - test: - name: 'ruby 3.0' - ruby-version: "3.0" - - publish: - filters: - branches: - only: master - tags: - ignore: /.*/ diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml new file mode 100644 index 0000000..8a94f8d --- /dev/null +++ b/.github/workflows/gem-push.yml @@ -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}}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dac8c12 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/safe_values.gemspec b/safe_values.gemspec index 2b88146..0208e48 100644 --- a/safe_values.gemspec +++ b/safe_values.gemspec @@ -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']