Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changepacks/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ignore": ["**", "!packages/python/pyproject.toml", "!packages/dotnet/BraillifyNet/BraillifyNet.csproj", "!packages/dotnet/Braillify/Braillify.csproj", "!packages/node/package.json", "!libs/braillify/Cargo.toml"],
"ignore": ["**", "!packages/python/pyproject.toml", "!packages/dotnet/BraillifyNet/BraillifyNet.csproj", "!packages/dotnet/Braillify/Braillify.csproj", "!packages/node/package.json", "!packages/ruby/Cargo.toml", "!libs/braillify/Cargo.toml"],
"baseBranch": "main",
"latestPackage": null,
"publish": {}
Expand Down
147 changes: 147 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ jobs:
with:
components: clippy, rustfmt
- uses: actions-rust-lang/setup-rust-toolchain@v1
# packages/ruby(rb-sys) 컴파일에 libruby가 필요하다.
# Windows는 pyo3/maturin(MSVC Python)과 ABI를 맞추기 위해 MSVC 빌드(mswin) Ruby를 쓴다.
# (ucrt Ruby는 GNU 툴체인을 요구해 한 번의 workspace-wide cargo 호출에서 pyo3와 공존 불가)
# mswin은 ruby master dev 빌드만 제공된다 — 실배포 플랫폼(ucrt) 검증은 ruby-test 잡이 담당.
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: ${{ matrix.platform == 'windows-latest' && 'mswin' || '3.4' }}
cargo-cache: true
- name: Cargo tarpaulin and fmt
run: |
cargo install cargo-tarpaulin
Expand Down Expand Up @@ -186,13 +194,52 @@ jobs:
run: dotnet test --no-build -c Release --verbosity normal --framework net9.0 Braillify.Tests/Braillify.Tests.csproj
working-directory: packages/dotnet

ruby-test:
name: Ruby Test - ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
# pull_request_target에서도 PR 코드를 체크아웃해 테스트한다.
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

# Ruby 플랫폼(Windows ucrt 등)에 맞는 Rust 타겟/bindgen 환경까지 구성하는
# rb-sys 공식 셋업 액션.
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.4"
bundler-cache: true
cargo-cache: true
working-directory: packages/ruby

# 실배포 gem 플랫폼(stable Ruby, Windows는 ucrt+GNU)에서의 lint.
# 루트 워크스페이스에서 실행해 [patch.crates-io]로 로컬 libs/braillify를 사용한다.
- name: Lint
run: cargo clippy -p braillify_rb --all-targets -- -D warnings

- name: Compile
run: bundle exec rake compile
working-directory: packages/ruby

- name: Test
run: bundle exec rake test
working-directory: packages/ruby

deploy-landing:
name: Deploy Landing
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- test
- dotnet-test
- ruby-test
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
Expand Down Expand Up @@ -240,6 +287,7 @@ jobs:
needs:
- test
- dotnet-test
- ruby-test
steps:
- uses: actions/checkout@v6
- uses: changepacks/action@main
Expand Down Expand Up @@ -803,3 +851,102 @@ jobs:
name: nuget-packages
path: packages/dotnet/**/nupkg/*.nupkg
retention-days: 1

# ruby
ruby-build:
name: Ruby Build - ${{ matrix.platform }}
runs-on: ubuntu-latest
if: ${{ contains(needs.changepacks.outputs.changepacks, 'packages/ruby/Cargo.toml') }}
needs:
- test
- dotnet-test
- ruby-test
- changepacks
strategy:
fail-fast: false
matrix:
platform:
- x86_64-linux
- aarch64-linux
- x86_64-darwin
- arm64-darwin
- x64-mingw-ucrt
steps:
- uses: actions/checkout@v6

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
working-directory: packages/ruby

# rb-sys-dock은 repo 루트를 마운트하므로 루트 워크스페이스의
# [patch.crates-io]가 적용되어 로컬 libs/braillify로 빌드된다.
- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: "3.1,3.2,3.3,3.4"
working-directory: packages/ruby

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ruby-gem-${{ matrix.platform }}
path: ${{ steps.cross-gem.outputs.gem-path }}
if-no-files-found: error

ruby-publish:
name: Ruby Publish
runs-on: ubuntu-latest
if: ${{ contains(needs.changepacks.outputs.changepacks, 'packages/ruby/Cargo.toml') }}
needs:
- changepacks
- ruby-build
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"

- name: Download platform gems
uses: actions/download-artifact@v8
with:
pattern: ruby-gem-*
path: gems

# 소스 gem (Rust 툴체인으로 설치하는 fallback)
- name: Build source gem
run: |
gem build braillify.gemspec
mkdir -p ../../gems/source
mv braillify-*.gem ../../gems/source/
working-directory: packages/ruby

- name: Publish
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
VERSION=$(ruby -e 'print File.read("packages/ruby/Cargo.toml")[/^version = "([^"]+)"/, 1]')

# 이미 publish된 버전/플랫폼 조합은 건너뛴다 (idempotent re-run).
# 최초 배포 시 versions 엔드포인트는 404를 반환하므로 빈 배열로 대체한다.
EXISTING=$(curl -fsSL "https://rubygems.org/api/v1/versions/braillify.json" || echo "[]")

for GEM in $(find gems -name '*.gem' -type f); do
BASE=$(basename "$GEM" .gem)
PLATFORM=${BASE#braillify-$VERSION}
PLATFORM=${PLATFORM#-}
PLATFORM=${PLATFORM:-ruby}
if echo "$EXISTING" | jq -e --arg v "$VERSION" --arg p "$PLATFORM" \
'any(.[]; .number == $v and .platform == $p)' > /dev/null; then
echo "::notice::braillify-$VERSION ($PLATFORM) is already on rubygems.org. Skipping."
continue
fi
gem push "$GEM"
done

1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- `libs/braillify/` — Rust 핵심 변환 엔진
- `packages/node/` — Node.js WASM 바인딩
- `packages/python/` — Python 바인딩 (maturin)
- `packages/ruby/` — Ruby 바인딩 (magnus + rb-sys, 워크스페이스 cargo 명령에 Ruby 3.x 필요)
- `apps/landing/` — Next.js 랜딩 페이지
- `test_cases/` — 점자 변환 테스트 케이스 (JSON)
- `docs/` — 2024 개정 한국 점자 규정 PDF
Expand Down
Loading
Loading