diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..03ae872 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,130 @@ +name: ci +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + cancel-in-progress: true +on: + workflow_dispatch: + push: + branches: + - main + tags: + - v*.*.* + pull_request: + types: [opened, synchronize] + branches: + - '*' + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ["3.0", "3.1", "3.2", "3.3", "3.4", "head"] + steps: + - uses: actions/checkout@v4 + - run: rm Gemfile.lock + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{matrix.ruby}} + bundler: latest + bundler-cache: true + - name: Run tests + run: bundle exec rake test + + package: + needs: [ "test" ] + name: "package (${{ matrix.platform }})" + strategy: + fail-fast: false + matrix: + platform: + - "ruby" + - "aarch64-linux-gnu" + - "aarch64-linux-musl" + - "arm64-darwin" + - "x64-mingw-ucrt" + - "x64-mingw32" + - "x86_64-darwin" + - "x86_64-linux-gnu" + - "x86_64-linux-musl" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rm Gemfile.lock + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler: latest + bundler-cache: true + - run: "bundle exec rake gem:${{matrix.platform}}" + - uses: actions/upload-artifact@v4 + with: + name: gem-${{matrix.platform}} + path: pkg + retention-days: 1 + + install-ruby: + name: "install (ruby)" + needs: [ "package" ] + runs-on: ubuntu-latest + steps: + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + - uses: actions/download-artifact@v4 + with: + name: gem-ruby + path: pkg + - run: "gem install pkg/tailwindcss-ruby-*.gem" + - run: "tailwindcss 2>&1 | fgrep 'ERROR: Cannot find the tailwindcss executable'" + + install-native: + name: "install (${{ matrix.platform }})" + needs: [ "package" ] + strategy: + fail-fast: false + matrix: + ruby: [ "3.4" ] + platform: + - "aarch64-linux-gnu" + - "aarch64-linux-musl" + - "arm64-darwin" + - "x64-mingw-ucrt" + # - "x64-mingw32" # because it's on a different version of ruby, we just add it in an "include" below + - "x86_64-darwin" + - "x86_64-linux-gnu" + - "x86_64-linux-musl" + include: + - { platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64/v8" } + - { platform: aarch64-linux-musl, docker_tag: "-alpine", docker_platform: "--platform=linux/arm64/v8", bootstrap: "apk add build-base &&" } + - { platform: arm64-darwin, runs_on: macos-14 } + - { platform: x64-mingw-ucrt, runs_on: windows-latest } + - { platform: x64-mingw32, runs_on: windows-latest, ruby: "3.0" } + - { platform: x86_64-darwin, runs_on: macos-13 } + - { platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" } + runs-on: ${{ matrix.runs_on || 'ubuntu-latest' }} + steps: + - uses: actions/download-artifact@v4 + with: + name: gem-${{ matrix.platform }} + path: pkg + - if: ${{ matrix.runs_on }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - if: ${{ matrix.runs_on }} + run: "gem install pkg/tailwindcss-ruby-*.gem" + - if: ${{ matrix.runs_on }} + run: "tailwindcss --help" + - if: ${{ (! matrix.runs_on) && matrix.docker_platform }} + run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - if: ${{ ! matrix.runs_on }} + run: | + docker run --rm -v $PWD:/tailwindcss-ruby -w /tailwindcss-ruby \ + ${{ matrix.docker_platform }} ruby:${{ matrix.ruby }}${{ matrix.docker_tag }} \ + sh -c " + ${{ matrix.bootstrap }} + gem install pkg/tailwindcss-ruby-*.gem + tailwindcss --help + " diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index 853598e..573bf98 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -9,7 +9,6 @@ on: push: branches: - main - - v4.x tags: - v*.*.* pull_request: @@ -27,15 +26,15 @@ jobs: - url: https://github.com/rails/tailwindcss-rails name: rails-unit command: "bin/test" - ruby: "3.3" + ruby: "3.4" - url: https://github.com/rails/tailwindcss-rails name: rails-install command: "env TAILWINDCSSOPTS=--path=../../.. test/integration/user_install_test.sh" - ruby: "3.3" + ruby: "3.4" - url: https://github.com/rails/tailwindcss-rails name: rails-upgrade command: "env TAILWINDCSSOPTS=--path=../../.. test/integration/user_upgrade_test.sh" - ruby: "3.3" + ruby: "3.4" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/gem-install.yml b/.github/workflows/gem-install.yml deleted file mode 100644 index 981194c..0000000 --- a/.github/workflows/gem-install.yml +++ /dev/null @@ -1,186 +0,0 @@ -name: packaging -concurrency: - group: "${{github.workflow}}-${{github.ref}}" - cancel-in-progress: true -on: - workflow_dispatch: - push: - branches: - - main - - v4.x - tags: - - v*.*.* - pull_request: - types: [opened, synchronize] - branches: - - '*' - -jobs: - package: - strategy: - fail-fast: false - matrix: - platform: - - "ruby" - - "x64-mingw32" - - "x64-mingw-ucrt" - - "x86_64-darwin" - - "arm64-darwin" - - "x86_64-linux-gnu" - - "x86_64-linux-musl" - - "aarch64-linux-gnu" - - "aarch64-linux-musl" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rm Gemfile.lock - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - bundler: latest - bundler-cache: true - - run: "bundle exec rake gem:${{matrix.platform}}" - - uses: actions/upload-artifact@v4 - with: - name: gem-${{matrix.platform}} - path: pkg - retention-days: 1 - - vanilla-install: - needs: ["package"] - runs-on: ubuntu-latest - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - - uses: actions/download-artifact@v4 - with: - name: gem-ruby - path: pkg - - run: "gem install pkg/tailwindcss-ruby-*.gem" - - run: "tailwindcss 2>&1 | fgrep 'ERROR: Cannot find the tailwindcss executable'" - - linux-x86_64-gnu-install: - needs: ["package"] - runs-on: ubuntu-latest - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - - uses: actions/download-artifact@v4 - with: - name: gem-x86_64-linux-gnu - path: pkg - - run: "gem install pkg/tailwindcss-ruby-*.gem" - - run: "tailwindcss --help" - - linux-x86_64-musl-install: - needs: ["package"] - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v4 - with: - name: gem-x86_64-linux-musl - path: pkg - - run: | - docker run --rm -v $PWD:/tailwindcss-ruby -w /tailwindcss-ruby \ - ruby:3.2-alpine \ - sh -c " - apk add build-base - gem install pkg/tailwindcss-ruby-*.gem - tailwindcss --help - " - - linux-aarch64-gnu-install: - needs: ["package"] - runs-on: ubuntu-latest - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - - uses: actions/download-artifact@v4 - with: - name: gem-aarch64-linux-gnu - path: pkg - - run: | - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - docker run --rm -v $PWD:/tailwindcss-ruby -w /tailwindcss-ruby \ - --platform=linux/arm64/v8 ruby:3.2 \ - sh -c " - gem install pkg/tailwindcss-ruby-*.gem - tailwindcss --help - " - - linux-aarch64-musl-install: - needs: ["package"] - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v4 - with: - name: gem-aarch64-linux-musl - path: pkg - - run: | - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - docker run --rm -v $PWD:/tailwindcss-ruby -w /tailwindcss-ruby \ - --platform=linux/arm64/v8 ruby:3.2-alpine \ - sh -c " - apk add build-base - gem install pkg/tailwindcss-ruby-*.gem - tailwindcss --help - " - - darwin-x86_64-install: - needs: ["package"] - runs-on: macos-13 - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - - uses: actions/download-artifact@v4 - with: - name: gem-x86_64-darwin - path: pkg - - run: "gem install pkg/tailwindcss-ruby-*.gem" - - run: "tailwindcss --help" - - darwin-arm64-install: - needs: ["package"] - runs-on: macos-14 - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - - uses: actions/download-artifact@v4 - with: - name: gem-arm64-darwin - path: pkg - - run: "gem install pkg/tailwindcss-ruby-*.gem" - - run: "tailwindcss --help" - - windows-install: - needs: ["package"] - runs-on: windows-latest - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.0" - - uses: actions/download-artifact@v4 - with: - name: gem-x64-mingw32 - path: pkg - - run: "gem install pkg/tailwindcss-ruby-*.gem" - - run: "tailwindcss --help" - - windows-ucrt-install: - needs: ["package"] - runs-on: windows-2022 - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - - uses: actions/download-artifact@v4 - with: - name: gem-x64-mingw-ucrt - path: pkg - - run: "gem install pkg/tailwindcss-ruby-*.gem" - - run: "tailwindcss --help" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 943726e..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: ci -concurrency: - group: "${{github.workflow}}-${{github.ref}}" - cancel-in-progress: true -on: - workflow_dispatch: - push: - branches: - - main - - v4* - tags: - - v*.*.* - pull_request: - types: [opened, synchronize] - branches: - - '*' - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - ruby: ["3.0", "3.1", "3.2", "3.3", "head"] - steps: - - uses: actions/checkout@v4 - - run: rm Gemfile.lock - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{matrix.ruby}} - bundler: latest - bundler-cache: true - - name: Run tests - run: bundle exec rake test diff --git a/CHANGELOG.md b/CHANGELOG.md index 681448b..354d40a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,89 @@ # tailwindcss-ruby changelog +## v4.1.8 + +* Update to [Tailwind CSS v4.1.8](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.1.8) @flavorjones + + +## v4.1.7 + +* Update to [Tailwind CSS v4.1.7](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.1.7) @flavorjones + + +## v4.1.6 + +* Update to [Tailwind CSS v4.1.6](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.1.6) @flavorjones + + +## v4.1.5 + +* Update to [Tailwind CSS v4.1.5](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.1.5) @flavorjones + + +## v4.1.4 + +* Update to [Tailwind CSS v4.1.4](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.1.4) @flavorjones + + +## v4.1.3 + +* Update to [Tailwind CSS v4.1.3](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.1.3) @flavorjones + + +## v4.0.17 + +* Update to [Tailwind CSS v4.0.17](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.17) @flavorjones + + +## v4.0.16 + +* Update to [Tailwind CSS v4.0.16](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.16) @flavorjones + + +## v4.0.15 + +* Update to [Tailwind CSS v4.0.15](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.15) @flavorjones + + +## v4.0.14 + +* Update to [Tailwind CSS v4.0.14](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.14) @flavorjones + + +## v4.0.12 + +* Update to [Tailwind CSS v4.0.12](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.12) @flavorjones + + +## v4.0.9 + +* Update to [Tailwind CSS v4.0.9](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.9) @flavorjones + + +## v4.0.8 + +* Update to [Tailwind CSS v4.0.8](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.8) @flavorjones + + +## v4.0.7 + +* Update to [Tailwind CSS v4.0.7](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.7) @flavorjones + + +## v4.0.6 + +* Update to [Tailwind CSS v4.0.6](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.6) @flavorjones + + Upgrade guide at https://tailwindcss.com/docs/upgrade-guide + + +## v4.0.5 + +* Update to [Tailwind CSS v4.0.5](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.5) @flavorjones + + Upgrade guide at https://tailwindcss.com/docs/upgrade-guide + + ## v4.0.4 * Update to [Tailwind CSS v4.0.4](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.4) @flavorjones diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a0bbc0..e4332fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,20 +4,26 @@ This doc is a brief introduction on modifying and maintaining this gem. ## Updating to the latest upstream tailwindcss version -Update `lib/tailwindcss/ruby/upstream.rb` with the upstream version. +Please don't submit PRs to the maintainer with an upstream bump. -Run `bundle exec rake clobber` then `bundle exec rake download` to ensure the tailwindcss binaries can be downloaded, and that you have the correct versions on local disk. +- [ ] run `bin/bump-upstream` +- [ ] push the branch, create a PR ## Cutting a release of tailwindcss-ruby -- bump the version +- if it's just bumping the upstream: + - [ ] follow the steps above + - [ ] when the PR is green, merge the PR + - [ ] create a git tag (after updating local `main`) +- else if the gem is being changed in some other way: - [ ] update `lib/tailwindcss/ruby/version.rb` - [ ] update `CHANGELOG.md` - - [ ] commit and create a git tag + - [ ] `git commit` + - [ ] `git tag` - build the native gems: - - [ ] `bundle exec rake clobber` if needed to clean up possibly-old tailwindcss executables + - [ ] `bundle exec rake clobber` (if needed to clean up old tailwindcss executables) - [ ] `bundle exec rake package` -- push +- push source and gems: - [ ] `for g in pkg/*.gem ; do gem push $g ; done` - [ ] `git push && git push --tags` - announce diff --git a/Gemfile.lock b/Gemfile.lock index 38de47d..db7a499 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,44 +1,44 @@ PATH remote: . specs: - tailwindcss-ruby (4.0.3) + tailwindcss-ruby (4.1.8) GEM remote: https://rubygems.org/ specs: ast (2.4.2) - json (2.9.1) - language_server-protocol (3.17.0.3) + json (2.10.2) + language_server-protocol (3.17.0.4) lint_roller (1.1.0) minitest (5.25.4) parallel (1.26.3) - parser (3.3.6.0) + parser (3.3.7.1) ast (~> 2.4.1) racc racc (1.8.1) rainbow (3.1.1) rake (13.2.1) regexp_parser (2.10.0) - rubocop (1.69.2) + rubocop (1.71.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.36.2, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.37.0) + rubocop-ast (1.38.0) parser (>= 3.3.1.0) rubocop-performance (1.23.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - standard (1.43.0) + standard (1.45.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.69.1) + rubocop (~> 1.71.0) standard-custom (~> 1.0.0) standard-performance (~> 1.6) standard-custom (1.0.2) @@ -47,7 +47,7 @@ GEM standard-performance (1.6.0) lint_roller (~> 1.1) rubocop-performance (~> 1.23.0) - unicode-display_width (3.1.3) + unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) diff --git a/README.md b/README.md index 65a256b..debfdce 100644 --- a/README.md +++ b/README.md @@ -93,28 +93,20 @@ $ bundle exec which tailwindcss # run the actual executable through the shim $ bundle exec tailwindcss --help -["/path/to/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/tailwindcss-ruby-0.1.0-x86_64-linux/exe/x86_64-linux/tailwindcss", "--help"] - -tailwindcss v3.4.3 +["/path/to/installs/installs/ruby/3.4.2/lib/ruby/gems/3.4.0/gems/tailwindcss-ruby-4.0.12-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss", "--help"] +≈ tailwindcss v4.0.12 Usage: - tailwindcss [--input input.css] [--output output.css] [--watch] [options...] - tailwindcss init [--full] [--postcss] [options...] - -Commands: - init [options] + tailwindcss [--input input.css] [--output output.css] [--watch] [options…] Options: - -i, --input Input file - -o, --output Output file - -w, --watch Watch for changes and rebuild as needed - -p, --poll Use polling instead of filesystem events when watching - --content Content paths to use for removing unused classes - --postcss Load custom PostCSS configuration - -m, --minify Minify the output - -c, --config Path to a custom config file - --no-autoprefixer Disable autoprefixer - -h, --help Display usage information + -i, --input ··········· Input file + -o, --output ·········· Output file [default: `-`] + -w, --watch ··········· Watch for changes and rebuild as needed + -m, --minify ·········· Optimize and minify the output + --optimize ········ Optimize the output without minifying + --cwd ············· The current working directory [default: `.`] + -h, --help ············ Display usage information ``` diff --git a/bin/bump-upstream b/bin/bump-upstream new file mode 100755 index 0000000..cb698e0 --- /dev/null +++ b/bin/bump-upstream @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +set -eu +set -o pipefail + +if [[ $# -lt 1 ]] ; then + echo "Usage: $(basename $0) " + echo + echo "Where is the tag name of the Tailwind CSS release." + exit 1 +fi + +PAGER="" # we don't want gh to use a pager +git_cmd=$(command -v git) +gh_cmd=$(command -v gh) +sed_cmd=$(command -v sed) + +fail() { + echo "Error: $*" >&2 + exit 1 +} + +upstream_tag=$1 +gem_version=$(echo $upstream_tag | $sed_cmd -E 's/^v//' | sed -E 's/-/./') +gem_tag="v${gem_version}" + +github_user=$($git_cmd config github.user || true) +if [[ -z "$github_user" ]]; then + fail "github.user is not set in git config" +fi + +# view the release. will fail if the release does not exist +$gh_cmd release view ${upstream_tag} --repo tailwindlabs/tailwindcss + +# get on the right starting branch +if [[ -n "$($git_cmd status --porcelain --untracked-files=no)" ]]; then + fail "found uncommitted changes" +fi + +if [[ $upstream_tag =~ ^v4 ]] ; then + base_branch="main" +elif [[ $upstream_tag =~ ^v3 ]] ; then + base_branch="v3.x" +else + fail "Whoa! A new major version? Need to update the ${0} script." +fi + +$git_cmd switch $base_branch + +if ! $git_cmd rev-parse --abbrev-ref @{push} >/dev/null 2>&1; then + fail "current branch is not tracking a remote branch" +fi + +# +# modify the upstream version and gem version +# +$sed_cmd -E -i "s/^(\s+)VERSION\s+=.*/\1VERSION = \"${upstream_tag}\"/" lib/tailwindcss/ruby/upstream.rb +$sed_cmd -E -i "s/^(\s+)VERSION\s+=.*/\1VERSION = \"${gem_version}\"/" lib/tailwindcss/ruby/version.rb + +bundle install + +# +# modify the changelog +# +replacement_text=$(cat < upstream release filename NATIVE_PLATFORMS = { diff --git a/lib/tailwindcss/ruby/version.rb b/lib/tailwindcss/ruby/version.rb index 719c055..3a9e190 100644 --- a/lib/tailwindcss/ruby/version.rb +++ b/lib/tailwindcss/ruby/version.rb @@ -2,6 +2,6 @@ module Tailwindcss module Ruby - VERSION = "4.0.4" + VERSION = "4.1.8" end end