Skip to content

Commit

Permalink
Merge pull request #5 from tamatebako/ror-sample
Browse files Browse the repository at this point in the history
feat: created RoR sample
  • Loading branch information
maxirmx authored Oct 8, 2024
2 parents 0826046 + 086e525 commit b2029e1
Show file tree
Hide file tree
Showing 65 changed files with 1,747 additions and 53 deletions.
61 changes: 54 additions & 7 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,23 +25,52 @@ 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

- name: Package
run: tebako press -e app.rb -o sinatra.teb -r sinatra -R ${{ matrix.package_ruby_ver }}
run: tebako press -e app.rb -o sinatra.tebako -r sinatra -R ${{ matrix.package_ruby_ver }}

- name: Test
run: ./sinatra.teb -h
- name: Smoke check
run: ./sinatra.tebako -h

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

- 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.tebako

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.tebako -r ror -R ${{ matrix.package_ruby_ver }}

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

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

- name: Start packaged Rails application
run: ./rails.tebako 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.tebako
57 changes: 51 additions & 6 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,13 @@ jobs:
uses: actions/checkout@v4

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

- name: Look around
run: ls -la
- name: Smoke check
run: ./sinatra.tebako -h

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

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

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

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.tebako -r ror

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

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

- name: Start packaged Rails application
run: ./rails.tebako 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.tebako
96 changes: 83 additions & 13 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 @@ -47,20 +47,20 @@ jobs:
run: |
docker run -v $PWD:/mnt/w -t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
tebako press --root=/mnt/w/sinatra --entry-point=app.rb \
--output=/mnt/w/sinatra-package --Ruby=3.2.5 --patchelf
--output=/mnt/w/sinatra.tebako --Ruby=3.2.5 --patchelf
- name: Upload tebako test packages
uses: actions/upload-artifact@v4
with:
name: sinatra-package
name: sinatra.tebako
retention-days: 1
path: |
sinatra-package
sinatra.tebako
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 All @@ -74,7 +74,7 @@ jobs:
- name: Download test packages
uses: actions/download-artifact@v4
with:
name: sinatra-package
name: sinatra.tebako

- name: Install OpenSSL 1.1
run: |
Expand All @@ -86,13 +86,13 @@ jobs:
fi
- name: Adjust package permissions
run: chmod +x sinatra-package
run: chmod +x sinatra.tebako

- name: Smoke check
run: ./sinatra-package -h
run: ./sinatra.tebako -h

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

Expand All @@ -103,4 +103,74 @@ jobs:
run: curl http://localhost:4567

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

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.tebako --Ruby=3.2.5 --patchelf
- name: Upload tebako test packages
uses: actions/upload-artifact@v4
with:
name: rails.tebako
retention-days: 1
path: |
rails.tebako
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.tebako

- 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.tebako

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

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

- name: Start packaged Rails application
run: ./rails.tebako 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 rails.tebako
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 b2029e1

Please sign in to comment.