From 7964dcbce23b2533af40c22dfe3f8ecd57026d95 Mon Sep 17 00:00:00 2001 From: Kenny Wong Date: Thu, 17 Jun 2021 16:11:51 -0400 Subject: [PATCH] Switch licensing to MIT, enable GitHub Actions (#2) * Add Ruby workflows * Change to MIT license * Install unix-odbc, Snowflake ODBC driver in CI workflow * Update documentation to mention unixodb, Snowflake ODBC driver, and GitHub Actions --- .github/workflows/gem-push.yml | 31 +++++++++++++++++++++++++ .github/workflows/ruby.yml | 40 +++++++++++++++++++++++++++++++++ .gitignore | 6 ++--- .ruby-gemset | 1 - .ruby-version | 1 - CHANGELOG.md | 6 +++++ LICENSE | 19 ++++++++++++++++ LICENSE.txt | 1 - README.md | 20 +++++++++++++++++ lib/sequel-snowflake/version.rb | 2 +- 10 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/gem-push.yml create mode 100644 .github/workflows/ruby.yml delete mode 100644 .ruby-gemset delete mode 100644 .ruby-version create mode 100644 LICENSE delete mode 100644 LICENSE.txt diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml new file mode 100644 index 0000000..3b51603 --- /dev/null +++ b/.github/workflows/gem-push.yml @@ -0,0 +1,31 @@ +name: Ruby Gem + +on: + push: + branches: [ main ] + +jobs: + build: + name: Build + Publish + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + + - 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/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..e740a16 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,40 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Ruby + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.6', '2.7', '3.0'] + + steps: + - uses: actions/checkout@v2 + - name: Install unix-odbc + run: sudo apt-get install unixodbc + - name: Install Snowflake ODBC driver + run: curl ${SNOWFLAKE_DRIVER_URL} -o snowflake_driver.deb && sudo dpkg -i snowflake_driver.deb + env: + SNOWFLAKE_DRIVER_URL: https://sfc-repo.snowflakecomputing.com/odbc/linux/latest/snowflake-odbc-2.23.2.x86_64.deb + - 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 rake + env: + SNOWFLAKE_CONN_STR: "${{secrets.SNOWFLAKE_CONN_STR}}" diff --git a/.gitignore b/.gitignore index 9db21c5..8b1aaf7 100644 --- a/.gitignore +++ b/.gitignore @@ -46,10 +46,8 @@ build-iPhoneSimulator/ # for a library or gem, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: Gemfile.lock -# Note: We include both in source control as we set up CI based on the specified version here. -# We _should_ modify the CI process so gem builds can go against an arbitrary Ruby version in the future. -# .ruby-version -# .ruby-gemset +.ruby-version +.ruby-gemset # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc diff --git a/.ruby-gemset b/.ruby-gemset deleted file mode 100644 index 5fe6b5c..0000000 --- a/.ruby-gemset +++ /dev/null @@ -1 +0,0 @@ -yesware diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index c0013a8..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-2.7.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index a132e03..6a981d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### 2.0.0 / 2021-06-16 + +* Change LICENSE to MIT (open source). +* This gem is now tested against Rubies 2.6, 2.7, and 3.0. + + ### 1.0.0 / 2021-04-22 [Initial Release] * Handle parsing Snowflake values for the following types: diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..84a1ef3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2021 Yesware, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index d10c633..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1 +0,0 @@ -Copyright (c) 2021 Yesware, Inc. All rights reserved. diff --git a/README.md b/README.md index f974f39..c5effa7 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ An adapter to connect to Snowflake databases using [Sequel](http://sequel.jeremyevans.net/). This provides proper types for returned values, as opposed to the ODBC adapter. +[![Ruby](https://github.com/Yesware/sequel-snowflake/actions/workflows/ruby.yml/badge.svg)](https://github.com/Yesware/sequel-snowflake/actions/workflows/ruby.yml) + ## Installation Add this line to your application's Gemfile: @@ -17,6 +19,11 @@ Or install it yourself as: $ gem install sequel-snowflake +You'll also need [unixODBC](http://www.unixodbc.org/) (if on Linux/macOS) and the appropriate +[Snowflake ODBC driver](https://sfc-repo.snowflakecomputing.com/odbc/index.html) in order to use +this adapter. Follow the Snowflake documentation on their ODBC Driver +[here](https://docs.snowflake.com/en/user-guide/odbc.html) before proceeding. + ## Usage When establishing the connection, specify `:snowflake` as the adapter to use. @@ -46,6 +53,19 @@ CLIENT_SESSION_KEEP_ALIVE=true; The test will create a temporary table on the specified database to run tests on, and this will be taken down either via the `after(:each)` blocks or when the connection is closed. +## GitHub Actions + +We have two workflows included in this project: + +* Ruby (`ruby.yml`): This runs the specs for this gem against Ruby 2.6, 2.7, and 3.0. Note +that this requires the secret `SNOWFLAKE_CONN_STR` to be set (see above for example connection string), +as we need to connect to Snowflake to run tests. These specs will be run for every pull request, +and is run after every commit to those branches. + +* Ruby Gem (`gem-push.yml`): This builds and pushes this gem to RubyGems, acting only on successful +pushes to the `main` branch. Note that this workflow requires a `RUBYGEMS_AUTH_TOKEN` secret to be set +to authenticate with RubyGems. + ## Contributing 1. Fork it ( https://github.com/Yesware/sequel-snowflake/fork ) diff --git a/lib/sequel-snowflake/version.rb b/lib/sequel-snowflake/version.rb index e88c459..9bbfa96 100644 --- a/lib/sequel-snowflake/version.rb +++ b/lib/sequel-snowflake/version.rb @@ -1,6 +1,6 @@ module Sequel module Snowflake # sequel-snowflake version - VERSION = "1.0.0" + VERSION = "2.0.0" end end