Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: return type not necessary #13

Merged
merged 6 commits into from
Sep 3, 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
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test
permissions: read-all

on:
push:

jobs:
test:
name: Test Ruby Versions
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [3.0, 3.1, 3.2, 3.3]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image for Ruby ${{ matrix.ruby-version }}
run: |
docker build --build-arg RUBY_VERSION=${{ matrix.ruby-version }} -t ruby-app:${{ matrix.ruby-version }} .

- name: Run Tests with Docker
run: |
docker run --rm ruby-app:${{ matrix.ruby-version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Makefile
mkmf.log
pkg
tdes.so
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG RUBY_VERSION=3.0

FROM ruby:${RUBY_VERSION}-alpine

WORKDIR /usr/src/app

RUN apk add build-base openssl-dev openssl-libs-static

COPY . .

RUN bundle install

CMD ["rake"]
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
tdes (3.0.6)
tdes (3.0.7)

GEM
remote: https://rubygems.org/
Expand Down
4 changes: 1 addition & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ Rake::TestTask.new do |t|
t.libs << 'test'
end

task release: :build do
system "gem push pkg/tdes-#{Tdes::VERSION}.gem"
end
task release: :build

desc 'Check if the compiled shared library exists'
task :check_compile do
Expand Down
2 changes: 1 addition & 1 deletion ext/tdes/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# On MacOS, have_func does not work well because the default compiler is clang instead of gcc
unless RUBY_PLATFORM.downcase.include? 'darwin'
abort 'missing DES_set_key_checked' unless have_func('int DES_set_key_checked', 'openssl/des.h')
abort 'missing DES_set_key_checked' unless have_func('DES_set_key_checked', 'openssl/des.h')
abort 'missing DES_ecb3_encrypt' unless have_func('DES_ecb3_encrypt', 'openssl/des.h')
# Check for a symbol/function specific to OpenSSL 3.x
abort 'OpenSSL 3.x required (missing EVP_Cipher function)' unless have_func('EVP_Cipher')
Expand Down
2 changes: 1 addition & 1 deletion lib/tdes/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Tdes
VERSION = '3.0.6'
VERSION = '3.0.7'
end
7 changes: 6 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Ruby native extension for triple DES cryptography.
rake --tasks
```

## Generate Makefile
```bash
ruby ext/tdes/extconf.rb
```

## Compile
```bash
rake clobber clean compile
Expand All @@ -18,7 +23,7 @@ rake test
```
Or
```bash
RUBY_VERSION=3.0 $SHELL -c 'docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp mirror.gcr.io/ruby:${RUBY_VERSION}-alpine bundle install && rake'
RUBY_VERSION=3.0 $SHELL -c 'docker build --build-arg RUBY_VERSION=${RUBY_VERSION} -t ruby-app:${RUBY_VERSION} . && docker run -it --rm ruby-app:${RUBY_VERSION}'
```

## Build local version
Expand Down