Skip to content

Commit a4650dd

Browse files
committed
Initial implementation
0 parents  commit a4650dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+6449
-0
lines changed

.github/workflows/build-gems.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Build Gems
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
name: Build ${{ matrix.target }} gem
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
target:
22+
- default
23+
- aarch64-linux-gnu
24+
- aarch64-linux-musl
25+
- arm-linux-gnu
26+
- arm-linux-musl
27+
- arm64-darwin
28+
- x86-linux-gnu
29+
- x86-linux-musl
30+
- x86_64-darwin
31+
- x86_64-linux-gnu
32+
- x86_64-linux-musl
33+
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 20
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Setup Ruby
41+
uses: ruby/setup-ruby@v1
42+
with:
43+
bundler-cache: true
44+
45+
- name: Build gem
46+
run: |
47+
if [ "${{ matrix.target }}" = "default" ]; then
48+
bundle exec rake build
49+
else
50+
bundle exec rake gem:${{ matrix.target }}
51+
fi
52+
53+
- name: Upload gem artifacts
54+
if: github.event_name == 'release'
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: gem-${{ matrix.target }}
58+
path: pkg/*.gem
59+
if-no-files-found: error
60+
retention-days: 7
61+
62+
push:
63+
name: Push gems with trusted publishing
64+
if: github.event_name == 'release' && github.repository_owner == 'marcoroth'
65+
needs: build
66+
timeout-minutes: 30
67+
runs-on: ubuntu-latest
68+
permissions:
69+
contents: write
70+
id-token: write
71+
72+
steps:
73+
- uses: actions/checkout@v4
74+
with:
75+
fetch-depth: 0
76+
77+
- name: Vendor release-gem patch
78+
uses: actions/checkout@v4
79+
with:
80+
repository: rubygems/release-gem
81+
ref: 1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
82+
path: .github/_release-gem
83+
84+
- name: Setup Ruby
85+
uses: ruby/setup-ruby@v1
86+
with:
87+
ruby-version: "3.4"
88+
bundler-cache: false
89+
90+
- name: Download gem artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
pattern: gem-*
94+
path: pkg/
95+
merge-multiple: true
96+
97+
- name: Configure trusted publishing credentials
98+
uses: rubygems/[email protected]
99+
100+
- name: Push gem with Sigstore attestation
101+
env:
102+
RUBYOPT: "-r${{ github.workspace }}/.github/_release-gem/rubygems-attestation-patch.rb"
103+
run: |
104+
cd pkg
105+
for gem_file in *.gem; do
106+
if [ -f "$gem_file" ]; then
107+
echo "Pushing $gem_file"
108+
gem push "$gem_file"
109+
fi
110+
done

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Ruby
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
name: Ruby ${{ matrix.ruby }}
14+
strategy:
15+
matrix:
16+
ruby:
17+
- '3.2'
18+
- '3.3'
19+
- '3.4'
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Ruby ${{ matrix.ruby }}
26+
uses: ruby/setup-ruby@v1
27+
with:
28+
ruby-version: ${{ matrix.ruby }}
29+
bundler-cache: true
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version-file: go/go.mod
35+
cache-dependency-path: go/go.sum
36+
37+
- name: Build Go Library
38+
run: bundle exec rake go:build
39+
40+
- name: Compile Native Extension
41+
run: bundle exec rake compile
42+
43+
- name: Run tests
44+
run: bundle exec mtest
45+
46+
- name: Run steep check
47+
run: bundle exec steep check
48+
49+
- name: Run rubocop
50+
run: bundle exec rubocop

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
/vendor/bundle/
10+
11+
# C extension build artifacts
12+
*.o
13+
*.so
14+
*.bundle
15+
*.bundle.dSYM
16+
*.dll
17+
Makefile
18+
mkmf.log
19+
20+
# Go build artifacts
21+
go/build/
22+
go/lipgloss.h
23+
24+
# IDE
25+
.idea/
26+
*.swp
27+
*.swo
28+
.vscode/
29+
30+
# OS
31+
.DS_Store
32+
Thumbs.db
33+
34+
# Gem
35+
*.gem

.rubocop.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
AllCops:
2+
NewCops: enable
3+
TargetRubyVersion: 3.2
4+
SuggestExtensions: false
5+
6+
Style/StringLiterals:
7+
EnforcedStyle: double_quotes
8+
9+
Style/StringLiteralsInInterpolation:
10+
EnforcedStyle: double_quotes
11+
12+
Style/Documentation:
13+
Enabled: false
14+
15+
Style/GlobalVars:
16+
Exclude:
17+
- ext/lipgloss/extconf.rb
18+
19+
Metrics/MethodLength:
20+
Max: 20
21+
22+
Metrics/ClassLength:
23+
Max: 200
24+
Exclude:
25+
- test/**
26+
27+
Metrics/BlockLength:
28+
Max: 50
29+
30+
Metrics/CyclomaticComplexity:
31+
Max: 10
32+
33+
Metrics/ParameterLists:
34+
Max: 10
35+
36+
Layout/LineLength:
37+
Exclude:
38+
- Rakefile
39+
- test/**
40+
41+
Security/Eval:
42+
Exclude:
43+
- Rakefile
44+
45+
Layout/LeadingCommentSpace:
46+
AllowRBSInlineAnnotation: true
47+
48+
Style/SymbolArray:
49+
EnforcedStyle: brackets
50+
51+
Style/WordArray:
52+
EnforcedStyle: brackets

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.4.7

Gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
gemspec
6+
7+
gem "irb"
8+
gem "maxitest"
9+
gem "minitest", "~> 5.16"
10+
gem "rake", "~> 13.0"
11+
gem "rake-compiler", "~> 1.2"
12+
gem "rake-compiler-dock", "~> 1.5"
13+
gem "rbs-inline", "~> 0.12"
14+
gem "rubocop", github: "rubocop/rubocop"
15+
gem "steep", "~> 1.10"

0 commit comments

Comments
 (0)