Skip to content

Commit

Permalink
Merge pull request #296 from rails/flavorjones-upstream-rails-testing
Browse files Browse the repository at this point in the history
ci: more thorough user journey, integrated with rails main
  • Loading branch information
flavorjones committed Dec 2, 2023
2 parents 9539fe5 + 5933a40 commit 56027ad
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 23 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ruby: ["2.7", "3.0", "3.1", "3.2", "head"]
steps:
- uses: actions/checkout@v3
- run: rm Gemfile.lock
Expand All @@ -40,11 +40,9 @@ jobs:
runs-on: ${{matrix.plat}}-latest
steps:
- uses: actions/checkout@v3
- run: rm Gemfile.lock
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
ruby-version: "3.2"
bundler: latest
- run: test/integration/user_journey_test.sh
shell: bash
15 changes: 8 additions & 7 deletions .github/workflows/gem-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run: rm Gemfile.lock
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
bundler: latest
bundler-cache: true
- run: "bundle exec rake gem:${{matrix.platform}}"
Expand All @@ -42,7 +42,7 @@ jobs:
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
- uses: actions/download-artifact@v3
with:
name: gem-ruby
Expand All @@ -56,7 +56,7 @@ jobs:
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
- uses: actions/download-artifact@v3
with:
name: gem-x86_64-linux
Expand All @@ -68,12 +68,13 @@ jobs:
needs: ["package"]
runs-on: ubuntu-latest
container:
image: ruby:3.1-alpine
image: ruby:3.2-alpine
steps:
- uses: actions/download-artifact@v3
with:
name: gem-x86_64-linux
path: pkg
- run: "apk add build-base" # to compile racc, etc.
- run: "gem update --system" # let's make sure the latest is working for us (upstream test, see #200)
- run: "gem install pkg/tailwindcss-rails-*.gem"
- run: "tailwindcss --help"
Expand All @@ -88,7 +89,7 @@ jobs:
path: pkg
- run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v "$(pwd):/test" -w /test --platform=linux/arm/v7 ruby:3.1 \
docker run --rm -v "$(pwd):/test" -w /test --platform=linux/arm/v7 ruby:3.2 \
/bin/bash -c "
set -ex
gem install pkg/tailwindcss-rails-*.gem
Expand All @@ -101,7 +102,7 @@ jobs:
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
- uses: actions/download-artifact@v3
with:
name: gem-x86_64-darwin
Expand Down Expand Up @@ -129,7 +130,7 @@ jobs:
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
- uses: actions/download-artifact@v3
with:
name: gem-x64-mingw-ucrt
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,20 @@ on:
- .github/workflows/upstream.yml # this file

jobs:
rails:
name: empty job
runs-on: ubuntu-latest
user-journey:
name: "user-journey (rails main)"
strategy:
fail-fast: false
matrix:
plat: ["ubuntu", "windows", "macos"]
runs-on: ${{matrix.plat}}-latest
env:
RAILSOPTS: --git=https://github.com/rails/rails --branch main
steps:
- run: echo hello world
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler: latest
- run: test/integration/user_journey_test.sh
shell: bash
32 changes: 24 additions & 8 deletions test/integration/user_journey_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,45 @@
set -o pipefail
set -eux

# set up dependencies
rm -f Gemfile.lock
bundle remove actionmailer
bundle add rails --skip-install ${RAILSOPTS:-}
bundle install

# fetch the upstream executables
bundle exec rake download

# create a rails app in a directory with spaces in the name (#176, #184)
rm -rf "Has A Space"
mkdir "Has A Space"
pushd "Has A Space"
# do our work a directory with spaces in the name (#176, #184)
rm -rf "My Workspace"
mkdir "My Workspace"
pushd "My Workspace"

gem install rails
rails new test-app --skip-bundle
# create a rails app
bundle exec rails -v
bundle exec rails new test-app --skip-bundle
pushd test-app

# install tailwindcss-rails
# make sure to use the same version of rails (e.g., install from git source if necessary)
bundle remove rails
bundle add rails --skip-install ${RAILSOPTS:-}

# use the tailwindcss-rails under test
bundle add tailwindcss-rails --path="../.."
bundle install
bundle show --paths

# install tailwindcss
bin/rails tailwindcss:install

# TEST: tailwind was installed correctly
grep tailwind app/views/layouts/application.html.erb

# TEST: rake tasks don't exec (#188)
cat <<EOF >> Rakefile
task :still_here do
puts "Rake process did not exit early"
end
EOF

# ensure rake tasks don't exec (#188)
bin/rails tailwindcss:build still_here | grep "Rake process did not exit early"

0 comments on commit 56027ad

Please sign in to comment.