Skip to content

Commit fbcffca

Browse files
authored
Merge branch 'main' into feat/application-attributes
2 parents a51283c + 1279a28 commit fbcffca

File tree

23 files changed

+540
-229
lines changed

23 files changed

+540
-229
lines changed

.circleci/config.yml

Lines changed: 0 additions & 152 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
# --- Test on multiple Ruby versions ---
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
ruby: [3.2, 3.3, 3.4]
15+
container:
16+
image: ruby:${{ matrix.ruby }}-alpine
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install OS packages
20+
run: apk add git build-base ruby-dev libsodium-dev
21+
- name: Cache bundle
22+
uses: actions/cache@v4
23+
with:
24+
path: vendor/bundle
25+
key: bundle-${{ hashFiles('Gemfile', 'discordrb.gemspec') }}-${{ matrix.ruby }}
26+
restore-keys: |
27+
bundle-${{ matrix.ruby }}
28+
- name: Install dependencies
29+
run: bundle install --path vendor/bundle
30+
- name: Run RSpec
31+
run: |
32+
mkdir -p rspec
33+
bundle exec rspec --format progress --format RspecJunitFormatter -o rspec/rspec.xml
34+
- name: Upload test results
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: rspec-results-${{ matrix.ruby }}
38+
path: rspec/rspec.xml
39+
40+
# --- Rubocop ---
41+
rubocop:
42+
runs-on: ubuntu-latest
43+
container:
44+
image: ruby:3.3-alpine
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Install OS packages
48+
run: apk add git build-base ruby-dev libsodium-dev
49+
- name: Cache bundle
50+
uses: actions/cache@v4
51+
with:
52+
path: vendor/bundle
53+
key: bundle-${{ hashFiles('Gemfile', 'discordrb.gemspec') }}-rubocop
54+
- name: Install dependencies
55+
run: bundle install --path vendor/bundle
56+
- name: Run Rubocop
57+
run: bundle exec rubocop
58+
59+
# --- Generate YARD docs ---
60+
yard:
61+
runs-on: ubuntu-latest
62+
container:
63+
image: ruby:3.3-alpine
64+
steps:
65+
- uses: actions/checkout@v4
66+
- name: Install OS packages
67+
run: apk add git build-base ruby-dev libsodium-dev
68+
- name: Cache bundle
69+
uses: actions/cache@v4
70+
with:
71+
path: vendor/bundle
72+
key: bundle-${{ hashFiles('Gemfile', 'discordrb.gemspec') }}-yard
73+
- name: Install dependencies
74+
run: bundle install --path vendor/bundle
75+
- name: Run YARD
76+
run: |
77+
mkdir -p docs
78+
bundle exec yard --output-dir docs

.github/workflows/deploy.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [main] # deploy only on merges to main
6+
tags:
7+
- "v*" # deploy when a version tag (e.g., v1.0.0) is created
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
container:
13+
image: ruby:3.3-alpine
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install OS packages
19+
run: apk add git build-base ruby-dev libsodium-dev
20+
21+
- name: Cache bundle
22+
uses: actions/cache@v4
23+
with:
24+
path: vendor/bundle
25+
key: bundle-${{ hashFiles('Gemfile', 'discordrb.gemspec') }}-yard
26+
27+
- name: Install dependencies
28+
run: bundle install --path vendor/bundle
29+
30+
- name: Generate YARD documentation
31+
run: |
32+
mkdir -p docs
33+
bundle exec yard --output-dir docs
34+
35+
- name: Determine deploy folder
36+
id: set_folder
37+
run: |
38+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
39+
echo "folder=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
40+
else
41+
echo "folder=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
42+
fi
43+
echo "Deploying to folder: ${{ steps.set_folder.outputs.folder }}"
44+
45+
- name: Deploy to GitHub Pages
46+
uses: peaceiris/actions-gh-pages@v4
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: docs
50+
publish_branch: gh-pages
51+
destination_dir: ${{ steps.set_folder.outputs.folder }}
52+
keep_files: true
53+
user_name: "GitHub Actions"
54+
user_email: "[email protected]"

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish RubyGems + GitHub Packages
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
packages: write
12+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
13+
contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
14+
15+
steps:
16+
- uses: actions/checkout@v5
17+
with:
18+
persist-credentials: false
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
bundler-cache: true
23+
ruby-version: ruby
24+
25+
- name: Validate tag matches gemspecs
26+
run: |
27+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
28+
for gemspec in *.gemspec; do
29+
GEM_VERSION=$(ruby -e "puts Gem::Specification.load('$gemspec').version")
30+
if [ "$TAG_VERSION" != "$GEM_VERSION" ]; then
31+
echo "::error::$gemspec version ($GEM_VERSION) does not match tag ($TAG_VERSION)"
32+
exit 1
33+
fi
34+
done
35+
36+
- uses: rubygems/release-gem@v1
37+
38+
- name: Publish to GitHub Packages
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: |
42+
OWNER=$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f1)
43+
for gemspec in *.gemspec; do
44+
gem build "$gemspec"
45+
done
46+
for gem_file in *.gem; do
47+
echo "Publishing $gem_file to GitHub Packages..."
48+
gem push "$gem_file" \
49+
--key github \
50+
--host "https://rubygems.pkg.github.com/${OWNER}" || true
51+
done

0 commit comments

Comments
 (0)