Skip to content

Commit

Permalink
Switch licensing to MIT, enable GitHub Actions (#2)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kwong-yw authored Jun 17, 2021
1 parent cc2490a commit 7964dcb
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 8 deletions.
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: 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}}"
40 changes: 40 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -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}}"
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .ruby-gemset

This file was deleted.

1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
1 change: 0 additions & 1 deletion LICENSE.txt

This file was deleted.

20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion lib/sequel-snowflake/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Sequel
module Snowflake
# sequel-snowflake version
VERSION = "1.0.0"
VERSION = "2.0.0"
end
end

0 comments on commit 7964dcb

Please sign in to comment.