Skip to content

Commit

Permalink
Add docs generation and deploy workflow
Browse files Browse the repository at this point in the history
Introduced a new workflow for generating and deploying API documentation to GitHub Pages. Integrated Postgres service setup in the build job to ensure the database is available for testing. This streamlines documentation deployment and enhances build reliability by ensuring dependencies are correctly configured.
  • Loading branch information
eliasjpr committed Aug 12, 2024
1 parent 3519709 commit f27c71a
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions .github/workflows/crystal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,55 @@ on:
branches: [master]

jobs:
docs:
runs-on: ubuntu-latest
container:
image: crystallang/crystal
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate Azu API Docs
run: crystal docs
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./docs"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
build:
runs-on: ubuntu-latest
container:
image: crystallang/crystal
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: example
POSTGRES_USER: example
POSTGRES_DB: example
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: shards install

- name: Build binary to test
run: shards build example_app

- name: Check code style
- name: Check code styl2e
run: crystal tool format --check

- name: Run tests
run: crystal spec
env:
Expand All @@ -33,8 +66,6 @@ jobs:
PORT_REUSE: false
HOST: 0.0.0.0

- name: Generate Azu API Docs
run: crystal docs
release:
runs-on: ubuntu-latest
needs:
Expand Down

0 comments on commit f27c71a

Please sign in to comment.