Skip to content

Commit

Permalink
feat: Ruby on Rails samples
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Oct 4, 2024
1 parent 0826046 commit 4610c08
Show file tree
Hide file tree
Showing 65 changed files with 1,708 additions and 40 deletions.
53 changes: 50 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: true

jobs:
test:
test-sinatra:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -25,6 +25,15 @@ jobs:
container:
image: ghcr.io/tamatebako/tebako-${{ matrix.container }}:latest
steps:
- name: Install curl/procps
run: |
if [ -e "/etc/lsb-release" ]; then
apt-get -y update
apt-get -y install curl procps
elif [ -e "/etc/alpine-release" ]; then
apk --no-cache --upgrade add curl procps
fi
- name: Checkout sample
uses: actions/checkout@v4

Expand All @@ -42,6 +51,26 @@ jobs:
- name: Wait for Sinatra to start
run: sleep 10

- name: Place GET request
run: |
curl http://localhost:4567
- name: End Sinatra application
run: pkill -f sinatra.teb

test-rails:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container:
- 'ubuntu-20.04'
- 'alpine-3.17'
package_ruby_ver:
- '3.2.5'
container:
image: ghcr.io/tamatebako/tebako-${{ matrix.container }}:latest
steps:
- name: Install curl/procps
run: |
if [ -e "/etc/lsb-release" ]; then
Expand All @@ -51,9 +80,27 @@ jobs:
apk --no-cache --upgrade add curl procps
fi
- name: Checkout sample
uses: actions/checkout@v4

- name: Package
run: tebako press -e bin/rails -o rails.teb -r ror -R ${{ matrix.package_ruby_ver }}

- name: Create data folder
run: mkdir -p ror-data

- name: Test
run: ./rails.teb server --help

- name: Start packaged Rails application
run: ./rails.teb server --port=4567 --tebako-mount local/tmp:$PWD/ror-data/tmp --tebako-mount local/log:$PWD/ror-data/log &

- name: Wait for Rails to start
run: sleep 10

- name: Place GET request
run: |
curl http://localhost:4567
- name: End Sinatra application
run: pkill -f sinatra.teb
- name: End Rails application
run: pkill -f rails.teb
56 changes: 49 additions & 7 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: true

jobs:
test:
test-sinatra:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -35,13 +35,10 @@ jobs:
uses: actions/checkout@v4

- name: Package
run: tebako press -e app.rb -o sample.tebako -r sinatra

- name: Look around
run: ls -la
run: tebako press -e app.rb -o sinatra.teb -r sinatra

- name: Start packaged Sinatra application
run: ./sample.tebako &
run: ./sinatra.teb &
env:
PORT: 4567

Expand All @@ -52,4 +49,49 @@ jobs:
run: curl http://localhost:4567

- name: End Sinatra application
run: pkill -f sample.tebako
run: pkill -f sinatra.teb

test-rails:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-13, macos-14 ]
steps:
- name: Select XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.3.1

- name: Brew install
run: |
brew install bison flex binutils libffi double-conversion boost jemalloc fmt glog gnu-sed bash zlib ncurses
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
- name: Install gem
run: gem install tebako

- name: Checkout sample
uses: actions/checkout@v4

- name: Package
run: tebako press -e bin/rails -o rails.teb -r ror

- name: Create data folder
run: mkdir -p ror-data

- name: Test
run: ./rails.teb server --help

- name: Start packaged Rails application
run: ./rails.teb server --port=4567 --tebako-mount local/tmp:$PWD/ror-data/tmp --tebako-mount local/log:$PWD/ror-data/log &

- name: Wait for Rails to start
run: sleep 10

- name: Place GET request
run: |
curl http://localhost:4567
- name: End Rails application
run: pkill -f rails.teb
80 changes: 75 additions & 5 deletions .github/workflows/rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ concurrency:
cancel-in-progress: true

jobs:
create-package:
name: Create tebako package
create-sinatra-package:
name: Create Sinatra package
runs-on: ubuntu-latest
steps:
- name: Checkout sample
Expand All @@ -57,10 +57,10 @@ jobs:
path: |
sinatra-package
run-package:
name: Run on ${{ matrix.container }}
test-sinatra:
name: Run Sinatra package on ${{ matrix.container }}
runs-on: ubuntu-latest
needs: [ create-package ]
needs: [ create-sinatra-package ]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -104,3 +104,73 @@ jobs:

- name: End Sinatra application
run: pkill -f sinatra-package

create-rails-package:
name: Create Rails package
runs-on: ubuntu-latest
steps:
- name: Checkout sample
uses: actions/checkout@v4

- name: Create tebako package
run: |
docker run -v $PWD:/mnt/w -t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
tebako press --root=/mnt/w/ror --entry-point=bin/rails \
--output=/mnt/w/rails-package --Ruby=3.2.5 --patchelf
- name: Upload tebako test packages
uses: actions/upload-artifact@v4
with:
name: rails-package
retention-days: 1
path: |
rails-package
test-rails:
name: Run rails package on ${{ matrix.container }}
runs-on: ubuntu-latest
needs: [ create-rails-package ]
strategy:
fail-fast: false
matrix:
container:
- 'rockylinux:9'
- 'fedora:39'
- 'quay.io/centos/centos:stream9'
container:
image: ${{ matrix.container }}
steps:
- name: Download test packages
uses: actions/download-artifact@v4
with:
name: rails-package

- name: Install OpenSSL 1.1
run: |
dnf -y install procps-ng
if [ "${{matrix.container}}" = "rockylinux:9" -o "${{matrix.container}}" = "quay.io/centos/centos:stream9" ] ; then
dnf -y install compat-openssl11
elif [ "${{matrix.container}}" = "fedora:39" ] ; then
dnf -y install openssl1.1
fi
- name: Adjust package permissions
run: chmod +x rails-package

- name: Create data folder
run: mkdir -p ror-data

- name: Smoke check
run: ./rails-package server --help

- name: Start packaged Rails application
run: ./rails-package server --port=4567 --tebako-mount local/tmp:$PWD/ror-data/tmp --tebako-mount local/log:$PWD/ror-data/log &

- name: Wait for Rails to start
run: sleep 10

- name: Place GET request
run: curl http://localhost:4567

- name: End Sinatra application
run: pkill -f sinatra-package
46 changes: 45 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,46 @@
sample.tebako
sinatra.teb
ror.teb
rails.teb
.vscode/

# Ignore all logfiles and tempfiles.
ror/log/*
ror/tmp/*
!ror/log/.keep
!ror/tmp/.keep

# Ignore pidfiles, but keep the directory.
ror/tmp/pids/*
!ror/tmp/pids/
!ror/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
ror/storage/*
!ror/storage/.keep
ror/tmp/storage/*
!ror/tmp/storage/
!ror/tmp/storage/.keep

#ror/public/assets

# Ignore master key for decrypting credentials and more.
# ror/config/master.key


# Ignore all logfiles and tempfiles.
ror/log/*
ror/tmp/*
!ror/log/.keep
!ror/tmp/.keep

# Ignore pidfiles, but keep the directory.
ror/tmp/pids/*
!ror/tmp/pids/
!ror/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
ror-data/*
!ror-data/storage/.keep

Gemfile.lock
log
Loading

0 comments on commit 4610c08

Please sign in to comment.