Skip to content

Commit 1d877fa

Browse files
committed
0 parents  commit 1d877fa

29 files changed

+1032
-0
lines changed

.devcontainer/Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG VARIANT="3"
2+
3+
FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT}
4+
5+
USER vscode
6+
WORKDIR /home/vscode
7+
8+
RUN mkdir -p .config/git \
9+
&& echo ".vscode/*" >> .config/git/ignore \
10+
&& echo "*.code-workspace" >> .config/git/ignore \
11+
&& echo ".history/" >> .config/git/ignore

.devcontainer/devcontainer.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
3+
"name": "Ruby",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"args": {
7+
"VARIANT": "3"
8+
}
9+
},
10+
"extensions": [
11+
"rebornix.Ruby",
12+
"ms-vsliveshare.vsliveshare",
13+
"EditorConfig.EditorConfig",
14+
"esbenp.prettier-vscode"
15+
],
16+
"postCreateCommand": "bundle install",
17+
"remoteUser": "vscode"
18+
}

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 2

.github/actions/setup/action.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Setup
3+
description: Setup Ruby and install dependencies.
4+
5+
inputs:
6+
ruby_version:
7+
description: The Ruby version.
8+
required: false
9+
default: '3.3.0'
10+
install_dependencies:
11+
description: Install dependencies.
12+
required: false
13+
default: 'true'
14+
gem_credentials:
15+
description: Gem credentials.
16+
required: false
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Setup credentials
22+
if: inputs.gem_credentials
23+
shell: bash
24+
run: |
25+
mkdir -p ~/.gem
26+
echo "$GEM_CREDENTIALS" > ~/.gem/credentials
27+
chmod 600 ~/.gem/credentials
28+
env:
29+
GEM_CREDENTIALS: ${{ inputs.gem_credentials }}
30+
- name: Setup Ruby
31+
uses: ruby/setup-ruby@v1
32+
with:
33+
bundler-cache: ${{ inputs.install_dependencies == 'true' }}
34+
ruby-version: ${{ inputs.ruby_version }}

.github/workflows/_build.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: _build
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
ruby_version:
8+
description: The Ruby version.
9+
type: string
10+
required: false
11+
default: '3.3.0'
12+
outputs:
13+
artifact_name:
14+
description: The artifact name.
15+
value: build-${{ github.sha }}
16+
17+
jobs:
18+
build:
19+
name: Gem
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 30
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Setup
26+
uses: ./.github/actions/setup
27+
with:
28+
ruby_version: ${{ inputs.ruby_version }}
29+
- name: Build
30+
run: bundle exec rake build
31+
- name: Upload artifact
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: build-${{ github.sha }}
35+
if-no-files-found: error
36+
path: pkg/

.github/workflows/_publish.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: _publish
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
artifact_name:
8+
description: The artifact name.
9+
type: string
10+
required: true
11+
registry_key:
12+
description: The gem registry credentials key.
13+
type: string
14+
required: true
15+
registry_host:
16+
description: The gem registry host.
17+
type: string
18+
required: true
19+
secrets:
20+
registry_credentials:
21+
description: The gem registry credentials.
22+
required: true
23+
24+
jobs:
25+
publish:
26+
name: Publish gem
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 30
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Setup
33+
uses: ./.github/actions/setup
34+
with:
35+
install_dependencies: 'false'
36+
gem_credentials: ':${{ inputs.registry_key }}: ${{ secrets.registry_credentials }}'
37+
- name: Download artifact
38+
uses: actions/download-artifact@v4
39+
with:
40+
name: ${{ inputs.artifact_name }}
41+
path: pkg/
42+
- name: Publish
43+
run: gem push --key $REGISTRY_KEY --host $REGISTRY_HOST $GEM_ARTIFACTS/*
44+
env:
45+
REGISTRY_KEY: ${{ inputs.registry_key }}
46+
REGISTRY_HOST: ${{ inputs.registry_host }}
47+
GEM_ARTIFACTS: pkg

.github/workflows/check.yml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
name: Check
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- '**'
11+
12+
jobs:
13+
test:
14+
name: Test (Ruby ${{ matrix.ruby }} on ${{ matrix.os_name }})
15+
runs-on: ${{ matrix.os }}
16+
timeout-minutes: 30
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os:
21+
- ubuntu-latest
22+
- macos-latest
23+
- windows-latest
24+
ruby:
25+
- '3.1'
26+
- '3.2'
27+
- '3.3'
28+
include:
29+
- os: ubuntu-latest
30+
os_name: Linux
31+
- os: macos-latest
32+
os_name: macOS
33+
- os: windows-latest
34+
os_name: Windows
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Setup
39+
uses: ./.github/actions/setup
40+
with:
41+
ruby_version: ${{ matrix.ruby }}
42+
- name: Test
43+
run: bundle exec rake test
44+
lint:
45+
name: Lint (Ruby ${{ matrix.ruby }})
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 30
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
ruby:
52+
- '3.1'
53+
- '3.2'
54+
- '3.3'
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
- name: Setup
59+
uses: ./.github/actions/setup
60+
with:
61+
ruby_version: ${{ matrix.ruby }}
62+
- name: Lint
63+
run: bundle exec rake lint
64+
build:
65+
name: Build
66+
uses: ./.github/workflows/_build.yml
67+
install:
68+
name: Install (Ruby ${{ matrix.ruby }} on ${{ matrix.os_name }})
69+
runs-on: ${{ matrix.os }}
70+
timeout-minutes: 30
71+
needs: build
72+
strategy:
73+
fail-fast: false
74+
matrix:
75+
os:
76+
- ubuntu-latest
77+
- macos-latest
78+
- windows-latest
79+
ruby:
80+
- '3.1'
81+
- '3.2'
82+
- '3.3'
83+
include:
84+
- os: ubuntu-latest
85+
os_name: Linux
86+
- os: macos-latest
87+
os_name: macOS
88+
- os: windows-latest
89+
os_name: Windows
90+
steps:
91+
- name: Setup Ruby
92+
uses: ruby/setup-ruby@v1
93+
with:
94+
ruby-version: ${{ matrix.ruby }}
95+
- name: Download artifact
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: ${{ needs.build.outputs.artifact_name }}
99+
path: .
100+
- name: Find gems
101+
uses: tj-actions/glob@v21
102+
id: gems
103+
with:
104+
files: '*.gem'
105+
- name: Create main.rb
106+
uses: DamianReeves/[email protected]
107+
with:
108+
write-mode: overwrite
109+
path: main.rb
110+
contents: |
111+
require 'seam'
112+
- name: Install
113+
run: gem install ${{ steps.gems.outputs.paths }}
114+
- name: Run
115+
run: ruby main.rb

.github/workflows/format.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Format
3+
4+
on:
5+
push:
6+
branches-ignore:
7+
- main
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
commit:
12+
name: Format code
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.head_ref }}
20+
token: ${{ secrets.GH_TOKEN }}
21+
- name: Import GPG key
22+
uses: crazy-max/ghaction-import-gpg@v6
23+
with:
24+
git_user_signingkey: true
25+
git_commit_gpgsign: true
26+
git_committer_name: ${{ secrets.GIT_USER_NAME }}
27+
git_committer_email: ${{ secrets.GIT_USER_EMAIL }}
28+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
29+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
30+
- name: Setup
31+
uses: ./.github/actions/setup
32+
- name: Format
33+
run: bundle exec rake format
34+
- name: Commit
35+
uses: stefanzweifel/git-auto-commit-action@v5
36+
if: always()
37+
with:
38+
commit_message: 'ci: Format code'
39+
commit_user_name: ${{ secrets.GIT_USER_NAME }}
40+
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
41+
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>

.github/workflows/generate.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Generate
3+
4+
on:
5+
push:
6+
branches-ignore:
7+
- main
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
commit:
12+
name: Generate code
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.head_ref }}
20+
token: ${{ secrets.GH_TOKEN }}
21+
- name: Import GPG key
22+
uses: crazy-max/ghaction-import-gpg@v6
23+
with:
24+
git_user_signingkey: true
25+
git_commit_gpgsign: true
26+
git_committer_name: ${{ secrets.GIT_USER_NAME }}
27+
git_committer_email: ${{ secrets.GIT_USER_EMAIL }}
28+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
29+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
30+
- name: Setup
31+
uses: ./.github/actions/setup
32+
with:
33+
install_dependencies: 'false'
34+
- name: Normalize Gemfile.lock
35+
run: bundle install
36+
- name: Commit
37+
uses: stefanzweifel/git-auto-commit-action@v5
38+
with:
39+
commit_message: 'ci: Generate code'
40+
commit_user_name: ${{ secrets.GIT_USER_NAME }}
41+
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
42+
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>

0 commit comments

Comments
 (0)