Skip to content

Commit 79f707f

Browse files
author
Erwan Thomas
committed
Merge branch 'ci-with-pages'
2 parents af2d305 + 9f6e455 commit 79f707f

File tree

6 files changed

+105
-31
lines changed

6 files changed

+105
-31
lines changed

.github/workflows/ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: ci
2+
3+
on: push
4+
5+
jobs:
6+
rubocop:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v3
11+
- name: Setup Ruby
12+
uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: ruby
15+
bundler-cache: true
16+
- name: Lint codebase
17+
run: bundle exec rubocop --parallel
18+
19+
rspec:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, macos-latest]
24+
ruby: ['2.7', '3.0', '3.1', '3.2']
25+
include:
26+
- os: ubuntu-latest
27+
ruby: '3.2'
28+
coverage: true
29+
runs-on: ${{ matrix.os }}
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v3
33+
- name: Setup Ruby
34+
uses: ruby/setup-ruby@v1
35+
with:
36+
ruby-version: ${{ matrix.ruby }}
37+
bundler-cache: true
38+
- name: Run specs
39+
run: bundle exec rspec
40+
env:
41+
COVERAGE: ${{ matrix.coverage }}
42+
- name: Generate coverage artifact
43+
if: ${{ matrix.coverage }}
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: docs-coverage
47+
path: docs/coverage
48+
49+
yard:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v3
54+
- name: Setup Ruby
55+
uses: ruby/setup-ruby@v1
56+
with:
57+
ruby-version: ruby
58+
bundler-cache: true
59+
- name: Generate Ruby API documentation
60+
run : bundle exec yard doc
61+
- name: Generate Ruby API documentation artifact
62+
uses: actions/upload-artifact@v3
63+
with:
64+
name: docs-ruby
65+
path: docs/ruby
66+
67+
pages:
68+
if: github.ref_name == 'master'
69+
needs:
70+
- rubocop
71+
- rspec
72+
- yard
73+
runs-on: ubuntu-latest
74+
permissions:
75+
contents: read
76+
pages: write # to deploy to Pages
77+
id-token: write # to verify the deployment originates from an appropriate source
78+
environment:
79+
name: github-pages
80+
url: ${{ steps.deployment.outputs.page_url }}
81+
steps:
82+
- name: Fetch Ruby API documentation artifact
83+
uses: actions/download-artifact@v3
84+
with:
85+
name: docs-ruby
86+
path: docs/ruby
87+
- name: Fetch coverage artifact
88+
uses: actions/download-artifact@v3
89+
with:
90+
name: docs-coverage
91+
path: docs/coverage
92+
- name: Setup Pages
93+
uses: actions/configure-pages@v3
94+
- name: Upload Pages
95+
uses: actions/upload-pages-artifact@v2
96+
with:
97+
path: docs
98+
- name: Deploy Pages
99+
id: deployment
100+
uses: actions/deploy-pages@v2

.github/workflows/validate.yml

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

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
spec/examples.txt
66

77
# SimpleCov artifacts
8-
/coverage
8+
/docs/coverage
99

1010
# YARD artifacts
1111
/.yardoc
12-
/doc
12+
/docs/ruby

.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
--output-dir docs/ruby
12
--markup markdown
23
--no-private

docs/.keep

Whitespace-only changes.

spec/support/simplecov.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
require "simplecov"
66

77
SimpleCov.start do
8+
coverage_dir "docs/coverage"
9+
810
enable_coverage :branch
911
end

0 commit comments

Comments
 (0)