Skip to content

Commit c8111e6

Browse files
bryanwiegBryan Wiegand
and
Bryan Wiegand
authored
Switch to CircleCI (#514)
Co-authored-by: Bryan Wiegand <[email protected]>
1 parent e3e79a0 commit c8111e6

19 files changed

+356
-182
lines changed

.circleci/config.yml

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/[email protected]
5+
6+
jobs:
7+
test_linux:
8+
parameters:
9+
ruby_version:
10+
description: 'version tag for the cimg/ruby container'
11+
type: string
12+
13+
machine:
14+
image: ubuntu-2004:current
15+
16+
# be sure to update the ./setup_cimgruby_dev.sh if changes are made to steps below
17+
steps:
18+
- checkout
19+
20+
- run:
21+
name: start docker-compose build environment
22+
command: |
23+
sudo ./test/bin/setup_volume_permissions.sh
24+
docker-compose up -d
25+
echo "Waiting for containers to start..."
26+
sleep 10
27+
28+
- run:
29+
name: install sql prereqs
30+
command: |
31+
docker exec cimg_ruby bash -c 'sudo -E ./test/bin/install-mssqltools.sh'
32+
33+
- run:
34+
name: setup tiny_tds test database
35+
command: |
36+
docker exec cimg_ruby bash -c './test/bin/setup_tinytds_db.sh'
37+
38+
- run:
39+
name: compile openssl library
40+
command: |
41+
docker exec cimg_ruby bash -c 'sudo -E ./test/bin/install-openssl.sh'
42+
43+
- run:
44+
name: compile freetds library
45+
command: |
46+
docker exec cimg_ruby bash -c 'sudo -E ./test/bin/install-freetds.sh'
47+
48+
- run:
49+
name: bundle install gems
50+
command: |
51+
docker exec cimg_ruby bash -c 'bundle install'
52+
53+
- run:
54+
name: build gem
55+
command: |
56+
docker exec cimg_ruby bash -c 'bundle exec rake build'
57+
58+
- run:
59+
name: test gem
60+
command: |
61+
docker exec cimg_ruby bash -c 'bundle exec rake test'
62+
63+
test_windows:
64+
parameters:
65+
ruby_version:
66+
description: 'version tag for rubydev environment'
67+
type: string
68+
69+
executor:
70+
name: win/server-2022
71+
shell: powershell.exe
72+
73+
environment:
74+
RAKEOPT: '-rdevkit'
75+
TESTOPTS: '-v'
76+
MAKE: 'make V=1 -j2'
77+
78+
steps:
79+
- run:
80+
name: remove pre-installed ruby
81+
command: |
82+
Get-ChildItem -path 'C:\tools\' -filter Ruby* | Remove-Item -Force -Recurse
83+
84+
- run:
85+
name: download and install ruby devkit
86+
command: |
87+
$uri = 'https://api.github.com/repos/oneclick/rubyinstaller2/tags?per_page=200'
88+
$releases = ((Invoke-WebRequest $uri) | ConvertFrom-Json).name | select-string -Pattern '<< parameters.ruby_version >>'
89+
$target_release = (($releases | Sort-Object -Descending)[0] | Out-String).Trim()
90+
$target_version = $target_release.Substring($target_release.Length - 7)
91+
$download_uri = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-$target_version/rubyinstaller-devkit-$target_version-x64.exe"
92+
echo "Ruby Target Version Found: $target_version"
93+
94+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
95+
Invoke-WebRequest -UseBasicParsing -uri $download_uri -OutFile ruby-setup.exe
96+
.\ruby-setup.exe /VERYSILENT /NORESTART /DIR=C:/Ruby<< parameters.ruby_version >>-x64
97+
98+
- run:
99+
name: ruby diagnostics
100+
command: |
101+
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
102+
echo "Perl Version:"
103+
perl --version
104+
echo "Ruby Version:"
105+
ruby --version
106+
echo "Gem Version:"
107+
gem --version
108+
rm .\ruby-setup.exe
109+
110+
- run:
111+
name: update build env
112+
command: |
113+
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
114+
ridk install 2
115+
gem install bundler
116+
117+
- checkout
118+
119+
- restore_cache:
120+
name: restore gem cache
121+
keys:
122+
- v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
123+
- v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-
124+
- v1-bundle-<< parameters.ruby_version >>-
125+
126+
- run:
127+
name: bundle install gems
128+
command: |
129+
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
130+
bundle install
131+
132+
- save_cache:
133+
name: save gem cache
134+
paths:
135+
- ./vendor/bundle
136+
key: v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
137+
138+
- run:
139+
name: build openssl
140+
no_output_timeout: 30m
141+
command: |
142+
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
143+
bundle exec rake ports:openssl
144+
145+
- run:
146+
name: build libiconv
147+
no_output_timeout: 30m
148+
command: |
149+
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
150+
bundle exec rake ports:libiconv
151+
152+
- run:
153+
name: build freetds
154+
no_output_timeout: 30m
155+
command: |
156+
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
157+
bundle exec rake ports:freetds
158+
159+
- run:
160+
name: build gem
161+
no_output_timeout: 30m
162+
command: |
163+
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
164+
bundle exec rake ports
165+
166+
workflows:
167+
test_supported_ruby_versions:
168+
jobs:
169+
- test_linux:
170+
matrix:
171+
parameters:
172+
ruby_version:
173+
- '2.5'
174+
- '2.6'
175+
- '2.7'
176+
177+
- test_windows:
178+
matrix:
179+
parameters:
180+
ruby_version:
181+
- '2.5'
182+
- '2.6'
183+
- '2.7'

.travis.yml

-25
This file was deleted.

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
22

3-
* [![TravisCI](https://travis-ci.org/rails-sqlserver/tiny_tds.svg?branch=master)](https://travis-ci.org/rails-sqlserver/tiny_tds) - TravisCI
4-
* [![Build Status](https://ci.appveyor.com/api/projects/status/g2bhhbsdkx0mal55/branch/master?svg=true)](https://ci.appveyor.com/project/rails-sqlserver/tiny-tds/branch/master) - Appveyor
3+
* [![CircleCI](https://circleci.com/gh/rails-sqlserver/tiny_tds.svg?style=svg)](https://app.circleci.com/pipelines/github/rails-sqlserver/tiny_tds) - CircleCi
54
* [![Gem Version](https://img.shields.io/gem/v/tiny_tds.svg)](https://rubygems.org/gems/tiny_tds) - Gem Version
65
* [![Gitter chat](https://img.shields.io/badge/%E2%8A%AA%20GITTER%20-JOIN%20CHAT%20%E2%86%92-brightgreen.svg?style=flat)](https://gitter.im/rails-sqlserver/activerecord-sqlserver-adapter) - Community
76

8-
97
## About TinyTDS
108

119
The TinyTDS gem is meant to serve the extremely common use-case of connecting, querying and iterating over results to Microsoft SQL Server or Sybase databases from Ruby using the FreeTDS's DB-Library API.

Rakefile

-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ end
5050

5151
task build: [:clean, :compile]
5252
task default: [:build, :test]
53-

appveyor.yml

-72
This file was deleted.

docker-compose.yml

+19-7
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,28 @@ services:
77
mssql:
88
image: metaskills/mssql-server-linux-tinytds:2017-GA
99
container_name: sqlserver
10+
environment:
11+
ACCEPT_EULA: Y
12+
SA_PASSWORD: super01S3cUr3
1013
ports:
1114
- "1433:1433"
12-
networks:
13-
- main-network
15+
network_mode: "host"
1416

1517
toxiproxy:
1618
image: shopify/toxiproxy
1719
container_name: toxiproxy
18-
ports:
19-
- "8474:8474"
20-
- "1234:1234"
21-
networks:
22-
- main-network
20+
command: '/toxiproxy -host=127.0.0.1'
21+
network_mode: "host"
22+
23+
cimgruby:
24+
image: cimg/ruby:2.7.0
25+
container_name: cimg_ruby
26+
environment:
27+
TESTOPTS: '-v'
28+
TINYTDS_UNIT_HOST: '127.0.0.1'
29+
SA_PASSWORD: super01S3cUr3
30+
TOXIPROXY_HOST: '127.0.0.1'
31+
command: tail -F anything
32+
volumes:
33+
- .:/home/circleci/project
34+
network_mode: "host"

setup_cimgruby_dev.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
set -e
5+
6+
# this should mirror the steps outlined in the circleci yml
7+
echo "Installing mssql-tools..."
8+
sleep 5
9+
sudo -E ./test/bin/install-mssqltools.sh
10+
11+
echo "Configurating tinytds test database..."
12+
sleep 5
13+
./test/bin/setup_tinytds_db.sh
14+
15+
echo "Building openssl library..."
16+
sleep 5
17+
sudo -E ./test/bin/install-openssl.sh
18+
19+
echo "Building freetds library..."
20+
sleep 5
21+
sudo -E ./test/bin/install-freetds.sh
22+
23+
echo "Installing gems..."
24+
sleep 5
25+
bundle install

start_dev.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
set -e
5+
6+
# set volume read/write permissions to work both outside and inside container
7+
sudo ./test/bin/setup_volume_permissions.sh
8+
9+
docker-compose up -d
10+
echo "Waiting for containers to start..."
11+
sleep 10
12+
13+
# setup circleci ruby container for development
14+
docker exec cimg_ruby bash -c './setup_cimgruby_dev.sh'
15+
16+
# enter container
17+
set +x
18+
echo "cimg/ruby container is ready for tiny_tds development.........."
19+
echo "To enter container run: docker exec -it cimg_ruby /bin/bash"
20+
echo "To build solution run: docker exec cimg_ruby bash -c 'bundle exec rake build'"
21+
echo "To test solution run: docker exec cimg_ruby bash -c 'bundle exec rake test'"

0 commit comments

Comments
 (0)