Skip to content

Commit 72823ee

Browse files
committed
Add test for the ruby feature
1 parent 94fe921 commit 72823ee

File tree

6 files changed

+42
-35
lines changed

6 files changed

+42
-35
lines changed

.github/workflows/test-features.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- sqlite3
1919
- activestorage
2020
- postgres-client
21+
- ruby
2122
baseImage:
2223
- debian:latest
2324
- ubuntu:latest
@@ -40,6 +41,7 @@ jobs:
4041
features:
4142
- activestorage
4243
- postgres-client
44+
- ruby
4345
steps:
4446
- uses: actions/checkout@v4
4547

.github/workflows/test-ruby-feature.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

features/src/ruby/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
55

66
apt-get update -y
7-
apt-get -y install --no-install-recommends libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential \
7+
apt-get -y install --no-install-recommends git curl ca-certificates libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential \
88
libyaml-dev libncurses5-dev libffi-dev libgdbm-dev libxml2-dev rustc
99

1010
git clone https://github.com/rbenv/rbenv.git /usr/local/share/rbenv
@@ -27,7 +27,7 @@ if [ "${USERNAME}" != "root" ]; then
2727
fi
2828
fi
2929

30-
su ${USERNAME} -c "rbenv install $VERSION"
31-
su ${USERNAME} -c "rbenv global $VERSION"
30+
su ${USERNAME} -c "/usr/local/share/rbenv/bin/rbenv install $VERSION"
31+
su ${USERNAME} -c "/usr/local/share/rbenv/bin/rbenv global $VERSION"
3232

3333
rm -rf /var/lib/apt/lists/*

features/test/ruby/scenarios.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version_3_3_0": {
3+
"image": "mcr.microsoft.com/devcontainers/base:1-bookworm",
4+
"features": {
5+
"ruby": {
6+
"version": "3.3.0"
7+
}
8+
}
9+
}
10+
}

features/test/ruby/test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
source dev-container-features-test-lib
5+
6+
check "PATH contains rbenv" bash -c "echo $PATH | grep rbenv"
7+
check "rbenv is installed" bash -c "rbenv --version"
8+
check "ruby-build is installed" bash -c "ls -l /root/.rbenv/plugins/ruby-build | grep '\-> /usr/local/share/ruby-build'"
9+
eval "$(rbenv init -)"
10+
check "Ruby is installed with YJIT" bash -c "RUBY_YJIT_ENABLE=1 ruby -v | grep +YJIT"
11+
check "Ruby version is set to 3.4.4" bash -c "rbenv global | grep 3.4.4"
12+
13+
reportResults
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -e
3+
4+
source dev-container-features-test-lib
5+
6+
check "PATH contains rbenv" bash -c "echo $PATH | grep rbenv"
7+
check "rbenv is installed" bash -c "rbenv --version"
8+
check "ruby-build is installed" bash -c "ls -l $HOME/.rbenv/plugins/ruby-build | grep '\-> /usr/local/share/ruby-build'"
9+
check "rbenv init is sourced in the bashrc" bash -c "grep 'eval \"\$(rbenv init -)\"' $HOME/.bashrc"
10+
check "rbenv init is sourced in the zshrc" bash -c "grep 'eval \"\$(rbenv init -)\"' $HOME/.zshrc"
11+
check "Ruby is installed with YJIT" bash -c "RUBY_YJIT_ENABLE=1 ruby -v | grep +YJIT"
12+
check "Ruby version is set to 3.3.0" bash -c "rbenv global | grep 3.3.0"
13+
14+
reportResults

0 commit comments

Comments
 (0)