Skip to content

Commit

Permalink
Setup gh-pages github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uvlad7 committed Oct 11, 2023
1 parent c827d41 commit a8d4760
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docs

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
name: Yard on Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- "2.7.8"
rust: ["nightly"]

steps:
- uses: actions/checkout@v3
# Rust is needed because I plan to setup yard-rustdoc
- name: Set up Ruby & Rust
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: ${{ matrix.ruby }}
rustup-toolchain: ${{ matrix.rust }}
bundler-cache: true
cargo-cache: true
rubygems: "3.4.14"
- name: Build yard docs
run: YARD_OUTPUT_DIR="${{ runner.temp }}/doc/" bundle exec rake yard
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: ${{ runner.temp }}/doc

deploy:
needs: build
name: Deploy to GitHub Pages

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master

pull_request:
types: [opened, reopened]

jobs:
build:
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ gem "rack"
gem "rackup"
# # Cause I want to use rack adapter with puma server
gem "puma"

7 changes: 5 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ require "rb_sys/extensiontask"

task build: :compile

RbSys::ExtensionTask.new("xml2json") do |ext|
gemspec = Gem::Specification.load("xml2json.gemspec")

RbSys::ExtensionTask.new("xml2json", gemspec) do |ext|
ext.lib_dir = "lib/xml2json"
end

require "yard"

YARD::Rake::YardocTask.new do |t|
t.files = ["lib/**/*.rb"]
t.files = gemspec.files.select { |f| File.extname(f) == ".rb" }
t.options += ["--output-dir", ENV["YARD_OUTPUT_DIR"]] if ENV["YARD_OUTPUT_DIR"]
end

task default: %i[compile spec rubocop yard]
3 changes: 2 additions & 1 deletion xml2json.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Gem::Specification.new do |spec|
# end
# end
spec.files = [
*Dir["ext/**/*"], *Dir["lib/**/*"], *Dir["sig/**/*"],
# .rb - to exclude lib/xml2json/xml2json.so
*Dir["ext/**/*"], *Dir["lib/**/*.rb"], *Dir["sig/**/*"],
"Cargo.lock", "Cargo.toml"
].reject { |f| File.directory?(f) }
spec.bindir = "exe"
Expand Down

0 comments on commit a8d4760

Please sign in to comment.