Skip to content

Commit

Permalink
Add docs workflow. Make bin/update-docs parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermoap committed Oct 4, 2023
1 parent bf625ca commit dbd170d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Update Docs

env:
RAILS_ENV: test

jobs:
openapi:
name: RSpec OpenAPI
runs-on: ubuntu-latest
timeout-minutes: 20

services:
db:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup Database
run: |
bundle exec rake parallel:load_schema
- name: Get CPU info
id: cpu_info
run: |
echo "cpu_cores=$(nproc)" >> $GITHUB_ENV
- name: Run tests and update docs
env:
PARALLEL_TESTS_CONCURRENCY: ${{ env.cpu_cores }}
run: ./bin/update-docs
- name: Check for untracked changes doc
uses: rootstrap/check_untracked_changes@v1
with:
path: "./doc"
6 changes: 5 additions & 1 deletion bin/update-docs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env bash

OPENAPI=1 bundle exec rspec spec/requests/api/ --seed 1993
if [[ -z $PARALLEL_TESTS_CONCURRENCY ]]; then
OPENAPI=1 bundle exec rspec spec/requests/api/ --seed 1993
else
OPENAPI=1 bundle exec parallel_rspec -n $PARALLEL_TESTS_CONCURRENCY spec/requests/api/ -o '--seed 1993'
fi

# sed command implementation is different for GNU and macOS
sed_i() {
Expand Down

0 comments on commit dbd170d

Please sign in to comment.